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

Example code errors #5

Open
sitch opened this issue Apr 14, 2022 · 3 comments
Open

Example code errors #5

sitch opened this issue Apr 14, 2022 · 3 comments

Comments

@sitch
Copy link

sitch commented Apr 14, 2022

On julia 1.7.1 errors out when running the example:

using JSON
using SwaggerMarkdown

@swagger """
/doge:
  get:
    description: doge
    responses:
      '200':
        description: Returns a doge.
"""

# the version of the OpenAPI used is required
openApi_version = "2.0"

# the info of the API, title and version of the info are required
info = Dict{String,Any}()
info["title"] = "Doge to the moon"
info["version"] = "1.0.5"

openApi = OpenAPI(openApi_version, info)

swagger_document = build(openApi)
swagger_json = JSON.json(swagger_document)
$ julia --project=. src/SwaggerSpec.jl
ERROR: LoadError: AssertionError: typeof(forward!(composer.input)) == DocumentStartEvent
Stacktrace:
  [1] compose_document(composer::YAML.Composer)
    @ YAML ~/.julia/packages/YAML/IXUQ4/src/composer.jl:49
  [2] compose(events::YAML.EventStream)
    @ YAML ~/.julia/packages/YAML/IXUQ4/src/composer.jl:38
  [3] load(ts::YAML.TokenStream, constructor::YAML.Constructor)
    @ YAML ~/.julia/packages/YAML/IXUQ4/src/YAML.jl:38
  [4] load(ts::YAML.TokenStream, more_constructors::Nothing, multi_constructors::Dict{Any, Any}; dicttype::Type{Dict{String, Any}}, constructorType::typeof(YAML.SafeConstructor))
    @ YAML ~/.julia/packages/YAML/IXUQ4/src/YAML.jl:44
  [5] #load#10
    @ ~/.julia/packages/YAML/IXUQ4/src/YAML.jl:47 [inlined]
  [6] #16
    @ ~/.julia/packages/YAML/IXUQ4/src/YAML.jl:96 [inlined]
  [7] open(::YAML.var"#16#17"{Base.Pairs{Symbol, DataType, Tuple{Symbol}, NamedTuple{(:dicttype,), Tuple{DataType}}}, Tuple{}}, ::String, ::Vararg{String}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Base ./io.jl:330
  [8] open
    @ ./io.jl:328 [inlined]
  [9] #load_file#15
    @ ~/.julia/packages/YAML/IXUQ4/src/YAML.jl:94 [inlined]
 [10] parse_spec()
    @ SwaggerMarkdown ~/.julia/packages/SwaggerMarkdown/PQQtk/src/Utils.jl:9
 [11] build(spec::OpenAPI; doc_parser::typeof(SwaggerMarkdown.parse_spec))
    @ SwaggerMarkdown ~/.julia/packages/SwaggerMarkdown/PQQtk/src/SwaggerMarkdown.jl:36
 [12] build(spec::OpenAPI)
    @ SwaggerMarkdown ~/.julia/packages/SwaggerMarkdown/PQQtk/src/SwaggerMarkdown.jl:34
 [13] top-level scope
    @ ~/sites/fortress/pair-api/src/SwaggerSpec.jl:23
    ```
@sitch
Copy link
Author

sitch commented Apr 14, 2022

Seems to be an issue with YAML JuliaData/YAML.jl#117

@jiachengzhang1
Copy link
Collaborator

I tried the example using 1.7.1 but I'm not able to reproduce the error. Can you share how your project is structured?

@sitch
Copy link
Author

sitch commented Apr 26, 2022

I tried this with a default genie app, and put the file in a few spots..

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

2 participants