-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Proposal: x-ms-examples #648
Comments
@veronicagg, @johanste - please review. Does this cover all the aspects w.r.t adding a sample for an operation ? |
Just to add a data point here -- take a look at the examples in the Search Management Spec. While there is no way yet to see how these will render in reference documentation, I found it was at least possible to include all the examples from our current REST API documentation in the spec. The convention I chose was to use the model type example for what I expect to render as the "request" example in the docs, and the example in the responses section for the "response" example. This covered all the cases, at least for our (admittedly simple) spec. What I like about the standard example element (besides the fact that it's already standard) is that it is simple and easy to use. My concern with this proposal as it stands is that it looks very complex, but then again maybe it is addressing scenarios that just don't matter for our spec. |
|
@brjohnstmsft @amarzavery i also noticed that on these lines of the spec you have an external docs node, but you don't have a title for it. When docs implements support for the externalDocs nodes we're going to need descriptive text to show to the user so they know what they're linking "to." Does the swagger spec allow for not providing a title for externalDocs? If so docs will need to come up with a way of supporting title-less externalDocs resources. |
@bradygaster The Open API spec says that only the URL is required. It looks like the description is optional. |
@brjohnstmsft that's valuable to know. @amarzavery since the description isn't required is SDK team planning on implying a convention to request titles/descriptions with those? If they're not there, what sort of link text would we show? I guess we'd just show the URL on-screen? Seems sub-optimal. |
@bradygaster I'm not sure teams other than Search regularly use |
@brjohnstmsft i think that'd be good - the experience would be a lot better if we had descriptions. that said, docs engineers will need to make sure we don't depend on their provision and handle the case(s) in which they're not there. |
@amarzavery what's the status on this proposal? Have you guys begun using the extension actively and if not, what's your ETA for doing so? We want to make sure the spec is up to your plans for use of the extension so let me know the POR. |
@bradygaster We're going forward with the extension. We're in the process of reviewing PR https://github.com/Azure/autorest/pull/1675/files/b4eec487239126225bf3364c04d6b22805952552..169ce10a0e1d423be825d52d6b8f29ea86ed9d5f to allow this extension in our schema. |
Closing since we are already using this extension. Please feel free to open a new bug for any issues on that extension. |
Hi, Is there any option to add multiple examples (.json files) with different values to one request ? From below example we need to add createStorageAccount1.json and createStorageAccount2.json to same "Create a storage account" "Create a storage account": { "$ref": "../examples/createStorageAccount.json" }, |
Current mechanism and its shortcomings
We looked at the current mechanism/format provided by swagger specification to provide examples.
produces
values (either implicit or inherited). The value SHOULD be an example of what such a response would look like.Illustration:
shortcomings/concerns: What if the service team wants to show different examples. Scenario: GET on NetworkInterface with $expand and without $expand will have an impact on the NetworkSecurityGroup property of the NIC. In the former it will be a full blown NSG and in the latter it will be a Subresource(object with one property ‘id’)?
shortcomings/concerns: Well this is good. But it does not provide a holistic picture of the entire request/response. We have to do extra processing to join the dots. When a Service developer thinks about an API endpoint, he/she would think in terms of sending a request to the endpoint and receiving a response from that endpoint.
Hence, having an extension at every operation level in a spec, would give us the biggest bang for the buck.
Benefits of this extension:
For example: The location of storage spec is:
This will keep the spec cleaner and easy to manage.
Structure of the extension
The text was updated successfully, but these errors were encountered: