livingsocial / swagger_yard

Swagger-UI compliant JSON generated from YARD. For RESTful Rails apps.
MIT License
51 stars 28 forks source link

Reuse constants from application in documentation #70

Closed StefSchenkelaars closed 2 years ago

StefSchenkelaars commented 2 years ago

I would like to be able to reuse definitions from the application in the API documentation without specifying them a second time. So to solve this i've made it possible to pass a constant that will be evaluated.


# @model
# @property currency [enum<{Product::CURRENCIES}>] The currency of the product
class Product
  CURRENCIES = %w[usd eur]
end
nicksieger commented 2 years ago

I love this idea! Great implementation and test cases too. Thanks for the contribution!