Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AN-242] Update MethodQuery schema in Swagger docs #1482

Merged
merged 2 commits into from
Nov 5, 2024

Conversation

sam-schu
Copy link
Contributor

@sam-schu sam-schu commented Nov 5, 2024

Jira ticket: https://broadworkbench.atlassian.net/browse/AN-242

Context

The MethodQuery schema in Swagger is used only by a single endpoint: POST /api/methods. The description of this endpoint specifies that namespace, name, payload, and entityType must be included in the request body, which has been verified, but the MethodQuery schema does not list these properties as required. Also, the schema provides default values for all of its properties, none of which are actually used by Orchestration in the case that they are not provided.

Changes

  • Updated the MethodQuery schema to make the namespace, name, payload, and entityType properties required and to change all default property values to example property values.

Testing

  • Tested in a BEE that the Swagger page is updated.

Visual aids

Before:
MethodQuery Swagger schema before image

After:
MethodQuery Swagger schema after image

I, the developer opening this PR, do solemnly pinky swear that:

  • I've followed the instructions if I've made any changes to the API, especially if they're breaking changes
  • I've updated the FISMA documentation if I've made any security-related changes, including auth, encryption, or auditing

In all cases:

  • Get two thumbsworth of review and PO signoff if necessary
  • Verify all tests go green
  • Squash and merge. Make sure your branch deletes; GitHub should do this for you.
  • Test this change deployed correctly and works on dev environment after deployment

@sam-schu sam-schu changed the title Update schema in Swagger yaml [AN-242] Update MethodQuery schema in Swagger docs Nov 5, 2024
@sam-schu sam-schu marked this pull request as ready for review November 5, 2024 16:16
Copy link

@LizBaldo LizBaldo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to move what used to be the default into an example section in the description fields instead? It does look like useful information, but I agree that they are not defaults

Copy link
Contributor

@aednichols aednichols left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The defaults are pretty much already used like examples, I do find them useful in this context.

Screenshot 2024-11-05 at 11 28 20

@sam-schu
Copy link
Contributor Author

sam-schu commented Nov 5, 2024

@aednichols I removed the defaults in line with the specification, which states that "[t]he default value represents what would be assumed by the consumer of the input as the value of the schema if one is not provided." Do we often enough use defaults contrary to this definition to represent examples that are not actually used as defaults by the backend that I should leave them as is?

@aednichols
Copy link
Contributor

If there's a way to adopt the spec and preserve the example payloads, I'm on board with that.

@aednichols
Copy link
Contributor

It looks like Leonardo does something reasonable with the example: key.

Swagger link
code link

@sam-schu
Copy link
Contributor Author

sam-schu commented Nov 5, 2024

@LizBaldo @aednichols Please take a look at the updated PR comment and let me know what you think. I added the example property values directly to the schema, and I confirmed that this does populate the "Example Value" for the request body in the endpoint that uses it.

Copy link
Contributor

@aednichols aednichols left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 👍

Most likely, this Swagger was written before example existed. Good to get things up to date.

@sam-schu sam-schu merged commit af3e069 into develop Nov 5, 2024
13 checks passed
@sam-schu sam-schu deleted the sts_AN-242_update_methodquery_schema branch November 5, 2024 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants