a-chacon / oas_rails

Generate Automatic Interactive Documentation for Your Rails API
GNU General Public License v3.0
70 stars 4 forks source link

Error 500 Request body example #50

Closed Metalzoid closed 3 months ago

Metalzoid commented 3 months ago

Hi, I try to make that request body example :

      # @request_body The Appointment to be created [!Hash{appointment: Hash{start_date: Datetime, end_date: Datetime, comment: String}, appointment_services: Array<Integer> }]
      # @request_body_example The Appointment to be created [Hash] {appointment: {start_date: '14/07/2024 10:00',end_date: '14/07/2024 10:30', comment: 'For my son.'}, appointment_services: [1, 2]}

Unsupport Array for appointment_services ?

but i get this error :


SyntaxError ((eval at /usr/share/rvm/gems/ruby-3.3.0/gems/oas_rails-0.6.0/lib/oas_rails/yard/oas_rails_factory.rb:111):1: syntax error, unexpected '}'):

oas_rails (0.6.0) lib/oas_rails/yard/oas_rails_factory.rb:111: (eval at /usr/share/rvm/gems/ruby-3.3.0/gems/oas_rails-0.6.0/lib/oas_rails/yard/oas_rails_factory.rb:111):1: syntax error, unexpected '}'
oas_rails (0.6.0) lib/oas_rails/yard/oas_rails_factory.rb:111:in `eval'
oas_rails (0.6.0) lib/oas_rails/yard/oas_rails_factory.rb:111:in `eval_content'
oas_rails (0.6.0) lib/oas_rails/yard/oas_rails_factory.rb:61:in `extract_description_type_and_content'
oas_rails (0.6.0) lib/oas_rails/yard/oas_rails_factory.rb:18:in `parse_tag_with_request_body_example'
yard (0.9.36) lib/yard/tags/library.rb:237:in `send_to_factory'
yard (0.9.36) lib/yard/tags/library.rb:169:in `request_body_example_tag'
yard (0.9.36) lib/yard/tags/library.rb:274:in `tag_create'
yard (0.9.36) lib/yard/docstring_parser.rb:215:in `create_tag'
yard (0.9.36) lib/yard/docstring_parser.rb:156:in `block in parse_content'
yard (0.9.36) lib/yard/docstring_parser.rb:142:in `each'
yard (0.9.36) lib/yard/docstring_parser.rb:142:in `each_with_index'
yard (0.9.36) lib/yard/docstring_parser.rb:142:in `parse_content'
yard (0.9.36) lib/yard/docstring_parser.rb:117:in `parse'
oas_rails (0.6.0) lib/oas_rails/oas_route.rb:28:in `extract_docstring'
oas_rails (0.6.0) lib/oas_rails/oas_route.rb:23:in `extract_rails_route_data'
oas_rails (0.6.0) lib/oas_rails/oas_route.rb:11:in `new_from_rails_route'
oas_rails (0.6.0) lib/oas_rails/extractors/route_extractor.rb:82:in `block in extract_host_routes'
oas_rails (0.6.0) lib/oas_rails/extractors/route_extractor.rb:82:in `map'
oas_rails (0.6.0) lib/oas_rails/extractors/route_extractor.rb:82:in `extract_host_routes'
oas_rails (0.6.0) lib/oas_rails/extractors/route_extractor.rb:24:in `host_routes_by_path'
oas_rails (0.6.0) lib/oas_rails/builders/path_item_builder.rb:10:in `from_path'
oas_rails (0.6.0) lib/oas_rails/spec/paths.rb:14:in `add_path'
oas_rails (0.6.0) lib/oas_rails/spec/specification.rb:25:in `block in build'
oas_rails (0.6.0) lib/oas_rails/spec/specification.rb:24:in `each'
oas_rails (0.6.0) lib/oas_rails/spec/specification.rb:24:in `build'
oas_rails (0.6.0) lib/oas_rails.rb:67:in `build'
oas_rails (0.6.0) app/controllers/oas_rails/oas_rails_controller.rb:9:in `block (2 levels) in index'
actionpack (7.1.4) lib/action_controller/metal/mime_responds.rb:214:in `respond_to'
oas_rails (0.6.0) app/controllers/oas_rails/oas_rails_controller.rb:6:in `index'

Thanks

a-chacon commented 3 months ago

Mmm I see the syntax is ok. Maybe the regex expression is cutting the string wrong. I don't know. But we need to review this lines of code

I have no time for do it this week. Sorry :)

Metalzoid commented 3 months ago

No problem, i going see this later ;)