-
Notifications
You must be signed in to change notification settings - Fork 737
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
Produce URI Snippet #299
Comments
This is already possible using the path parameters snippet.
Generally speaking, I'm not keen on encouraging people to prominently document URIs. It leads to brittle documentation and can undo all of the hard work and benefits of adopting hypermedia. Unless there's an overwhelming number of people who would like this to be supported out of the box, I'd prefer to leave it as something that you add yourself. It's only a handful of lines:
The accompanying template, named
The new snippet can then be used like this:
Alternatively, you could configure it as one of the default snippets so that it's always generated. |
Fantastic, thanks for the really useful reply. I guess I thought that seeing as the URI is in all the curl snippets anyway it wouldn't be that much of a stretch to have it on it's own. Well now you've given me the technique to do it, that's great, thanks so much. Love this project BTW, am mandating it's adoption for all internal and external APIs in my organization. |
Given that no one else has requested this, it's simple to roll your own, and explicitly documenting URIs isn't something I'm keen to encourage, I'm going to close this one. |
Reopening as this requirement has been raised again (see #497). |
I'm willing to look at creating a PR for this - as far as I understand, the main desired element not currently supported by provided snippets is standardized documentation of the URI (template-style). I'll look to include that URI, and in addition the verb and accept/content-type headers in the snippet as an initial proposal (from experience thus far, those three elements are what are most important to uniquely identifies a resource on an application) |
It would be useful to be able to document a resources URI as part of documenting a given resource, this could use the custom scheme, server and port as configured in mock mvc.
It would be great if it could also include placeholders so output could something like
http://api.example.com/resources
for a collection, or
http://api.example.com/resources/{id}
For an individual resource
Bonus points if it could also produce a path variable table that could describe path variables like {id} above.
This would be obviously useful to document consumers, but also for producers as they wouldn't have to coordinate between the request snippets produced by restdocs and 'hardcoded' URIs in the asciidoc templates.
The text was updated successfully, but these errors were encountered: