Closed Quiwin closed 4 years ago
We could add also add a list of os in travis to test against linux and osx if you are ok with that.
Love this, will release a 1.0.3 shortly! Thanks for the contribution!
@Quiwin - Thanks for providing this functionality! Was trying to use @example
tags with a @!model
declared class but couldn't get the specs to show the examples.
Appreciate any tips on how the following can be achieved:
# @!model CreatePet
# @property id(required) [integer]
# @example id
# 3
# @property name(required) [string]
# @example name
# "Test"
Hello @mengkuan - I'm sorry but i'm not able to reproduce it. Your example generates this json for me:
"components": {
"schemas": {
"CreatePet": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"example": 3
},
"name": {
"type": "string",
"example": "Test"
}
},
"required": [
"id",
"name"
]
}
},
"securitySchemes": {
}
}
If you have more informations I will be happy to investigate!
Hi @Quiwin - Apologies for the false alarm. I had that within a controller previously and it didn't work. After taking it out of the controller it worked immediately. Thanks for investigating!
i'm also having a hard time getting this to work.
can you tell me where it should be located so it's being picked up? i tried controller and serializer, but no luck yet
@mraerino - Not sure if this is helpful for you, I realized later on that in my case I had the @!model
declared within a controller. In order for that to be picked up by swagger_yard, you have to make swagger_yard look at controller classes as well for model declarations in swagger_yard's initializer. For instance, something like this works for me:
config.model_path = [::Rails.root + 'app/models/**/*',
::Rails.root + 'app/controllers/**/*']
@mengkuan @mraerino If either of you can suggest README updates that would make this clearer, let me know. Even better, would appreciate a PR!
Hello,
Really appreciate this project! The goal of this pull request is to add a way to create model without the need of a matching class. For example it is useful when some fields are required in POST but not in PATCH.
This directive generate a @model tag with a dummy class taking the name given to the directive. All tags and docstring given to the directive are passed to the generated @model.
Also update ruby versions tested and remove the specification of patch to keep them up-to-date. Furthermore I removed the .ruby-version file since its not really needed in a library, what is your take on it?