Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swagger Markdown example in docs fails #250

Open
EthanL-LinkedAll opened this issue Feb 27, 2025 · 0 comments
Open

Swagger Markdown example in docs fails #250

EthanL-LinkedAll opened this issue Feb 27, 2025 · 0 comments

Comments

@EthanL-LinkedAll
Copy link

This is the example from the docs:

using Oxygen
using SwaggerMarkdown

# Here's an example of how you can merge autogenerated docs from SwaggerMarkdown.jl into your api
@swagger """
/divide/{a}/{b}:
  get:
    description: Return the result of a / b
    parameters:
      - name: a
        in: path
        required: true
        description: this is the value of the numerator 
        schema:
          type : number
    responses:
      '200':
        description: Successfully returned an number.
"""
@get "/divide/{a}/{b}" function (req, a::Float64, b::Float64)
    return a / b
end

# title and version are required
info = Dict("title" => "My Demo Api", "version" => "1.0.0")
openApi = OpenAPI("3.0", info)
swagger_document = build(openApi)
  
# merge the SwaggerMarkdown schema with the internal schema
mergeschema(swagger_document)

# start the web server
serve()

It gives this error:

ERROR: LoadError: while parsing a block mapping at line 3, column 8: expected <block end>, but found YAML.BlockMappingStartToken at line 6, column 26

(I know this is supposed to be fixable by fixing the spacing, but I haven't been able to get it right yet, and even the example from the docs doesn't run, so I wonder if something might have changed.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant