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
Let's assume existence of User definition, and Submission definition. The Submission definition can contain User fields author and submitter. I'd like to document author and submitter.
I've went to editor.swagger.io. Having taken the petstore_full.yaml example, I've tried to apply the suggestion from OAI/OpenAPI-Specification#556 (comment 192007034). Taking the Pet definition:
I've made the following change to category property:
category:
description: This is pet's category.allOf:
- $ref: "#/definitions/Category"
I've tried to generate the Go code for this, but (aside from editor itself showing 'undefined' at one point) the generator made that field disappear.
It would be nice if the field didn't disappear, and if the description was put in the leading comment of the Go struct field.
There is an even worse behavior if you try to do this to an operation's parameter:
paths:
/pets:
post:
tags:
- petsummary: Add a new pet to the storedescription: ""operationId: addPetconsumes:
- application/json
- application/xmlproduces:
- application/json
- application/xmlparameters:
- in: bodyname: bodydescription: Pet object that needs to be added to the storerequired: falseschema:
description: blehallOf:
- $ref: "#/definitions/Pet"
which causes this (newlines added for readability):
Unable to build target:
Could not process operation:
Tag: pet
Operation: addPet
Resource: post /pets
Definitions: {User=io.swagger.models.ModelImpl@1e62688a, Category=io.swagger.models.ModelImpl@5e24b60b, Pet=io.swagger.models.ModelImpl@bfb7fbb1, Tag=io.swagger.models.ModelImpl@5e24b60b, Order=io.swagger.models.ModelImpl@b8396aae}
Exception: null
(Of course, this issue applies only if the cited comment isn't misleading -- that is, if the spec is actually supposed to support this way of documenting property usages. I believe it'd be a very useful behavior, but maybe it's really not supposed to be supported at the moment.)
The text was updated successfully, but these errors were encountered:
@ivucica thanks for reporting the issue. Here are 2 suggestions:
use the latest master to generate the Go API client, which has 35 PRs (enhancement, bug fix) since the last stable release v2.1.6. (editor.swagger.io is using the latest stable version v2.1.6)
Go does not have any support of inheritance/model composition at the moment so I would suggest you to avoid using allOf to define your model for the time being. We plan to provide better support of inheritance/model composition to API clients in coming July
Cheers,
Let's assume existence of
User
definition, andSubmission
definition. TheSubmission
definition can containUser
fieldsauthor
andsubmitter
. I'd like to documentauthor
andsubmitter
.I've went to editor.swagger.io. Having taken the
petstore_full.yaml
example, I've tried to apply the suggestion from OAI/OpenAPI-Specification#556 (comment 192007034). Taking thePet
definition:I've made the following change to
category
property:I've tried to generate the Go code for this, but (aside from editor itself showing 'undefined' at one point) the generator made that field disappear.
It would be nice if the field didn't disappear, and if the description was put in the leading comment of the Go struct field.
There is an even worse behavior if you try to do this to an operation's parameter:
which causes this (newlines added for readability):
(Of course, this issue applies only if the cited comment isn't misleading -- that is, if the spec is actually supposed to support this way of documenting property usages. I believe it'd be a very useful behavior, but maybe it's really not supposed to be supported at the moment.)
The text was updated successfully, but these errors were encountered: