-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[ML] Adding OAS examples to public APIs #243385
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
base: main
Are you sure you want to change the base?
[ML] Adding OAS examples to public APIs #243385
Conversation
|
🤖 Jobs for this PR can be triggered through checkboxes. 🚧
ℹ️ To trigger the CI, please tick the checkbox below 👇
|
szabosteve
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
jloleysens
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drive by comment
| }, | ||
| }, | ||
| options: { | ||
| oasOperationObject: () => ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good! Nice work @jgowdyelastic ! Minor suggestion: factorizing these examples into another file might keep the flow of your route definition a bit slimmer. Also, using TypeScript, you can check that value matches what your code returns. Up to you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've changed this for yml files rather than inline JSON
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testing this locally, I'm getting this error for the saved_objects/sync endpoint:
│ /paths/~1api~1ml~1saved_objects~1sync/get/responses/401/content/application~1json
│ must have required property 'examples'
│ Failed check @ schema path: #/required
I've no idea what I'm missing, the yml file contains examples.
I've tried updating the yml file to contain a 401 section, but I'm still getting the error:
responses:
'200':
content:
application/json:
examples:
successSyncResponse:
value:
savedObjectsCreated:
'anomaly-detector':
'test-job':
success: true
savedObjectsDeleted: {}
datafeedsAdded: {}
datafeedsRemoved: {}
'401':
content:
application/json:
examples:
failedSyncResponse:
value:
'statusCode': 401
'error': 'Unauthorized'
'message': "[security_exception\n\tRoot causes:\n\t\tsecurity_exception: unable to authenticate user [test] for REST request [/_security/_authenticate]]: unable to authenticate user [test] for REST request [/_security/_authenticate]"
I also have no idea why this endpoint requires a 401 section when the others do not?
…stic/kibana into adding-examples-to-public-apis
Adding request and response examples for our public saved object APIs