You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want my API documentation to be concise. Therefor, I want to define anything repeating in the top level members in Swagger object. Since I'm using JSON API , I have some boilerplate, as data followed by the actual representation in the resource. Usual definition of 201 response, looks like:
responses:
Created:
description: new resource
headers:
Location:
type: string
format: uri
schema:
type: object
required:
- data
properties:
- data:
$ref: '#/definitions/resourceDefinition'
I will use that Created definition in my Operations object as:
responses:
'201':
$ref: '#/definitions/Created'
And that's great. But, how can I pass an argument in the form of resourceDefinition and any other parts that I will need? Every API endpoint has its own resource definitions (and other specifics) and my API documentation (in comments in above the code) would be too large to write it constantly. I failed to find a way to pass argument to referenced object.
I don't think this is something which the OpenAPI spec wants to do, though maybe some kind of tooling can pre-process your input into the official form.
Though maybe this can be incorporated in some way in #555 (or meta-issue #586).
Closing this as it is indeed duplicated over tickets mentioned in #555 and should be covered there (best to keep discussions in one place). Personally, I see the value in parameterized data types, which is a solution to the problem.
@tenodi - keep in mind that your proposal will not work unless we decide to go with a 'fix' for #556.
I want my API documentation to be concise. Therefor, I want to define anything repeating in the top level members in
Swagger object
. Since I'm using JSON API , I have some boilerplate, asdata
followed by the actual representation in the resource. Usual definition of201
response, looks like:I will use that
Created
definition in myOperations object
as:And that's great. But, how can I pass an argument in the form of
resourceDefinition
and any other parts that I will need? Every API endpoint has its own resource definitions (and other specifics) and my API documentation (in comments in above the code) would be too large to write it constantly. I failed to find a way to pass argument to referenced object.Is there anything I could do?
This is what I would like to be able to do:
Docs above my API endpoint:
Docs in top level responses property:
The text was updated successfully, but these errors were encountered: