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

AsyncApi doc genearation without root tag #40

Closed
strelchm opened this issue Jan 28, 2022 · 4 comments
Closed

AsyncApi doc genearation without root tag #40

strelchm opened this issue Jan 28, 2022 · 4 comments

Comments

@strelchm
Copy link
Contributor

strelchm commented Jan 28, 2022

Now my generation document on http://localhost:8086/springwolf/docs is:
{ "myproject": { "asyncapi": "2.2.0" "info": { .... } ...... } }
The root node's "myproject" name is from part of AsyncApiConfig:

    @Bean
    public AsyncApiDocket asyncApiDocket() {
        Info info = Info.builder()
                .version("1.0.0")
                .title("myproject")
                .build();

If I set title to null, NullPointerException hapens.

When i try to generate client schema by AsyncApi generator
# ag http://localhost:8086/springwolf/docs @asyncapi/java-spring-template
I get the error:

Something went wrong:
Error: The `asyncapi` field is missing.
    at parse (/usr/local/lib/node_modules/@asyncapi/generator/node_modules/@asyncapi/parser/lib/parser.js:72:13)
    at Generator.generateFromString (/usr/local/lib/node_modules/@asyncapi/generator/lib/generator.js:265:28)
    at Generator.generateFromURL (/usr/local/lib/node_modules/@asyncapi/generator/lib/generator.js:298:17)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at /usr/local/lib/node_modules/@asyncapi/generator/cli.js:156:9

In the code of parser.js exception happens if there is no field "asyncapi" in Json (at first level). How can I generate the asyncapi document without root project title tag?

@stavshamir
Copy link
Member

Thanks for reporting thus issue!
This behavior is intentional, but I realize now that it may interrupt flows like yours.
I think the more reasonable solution here will be to return the valid asyncapi doc directly from http://localhost:8086/springwolf/docs.

I make the change and then close this issue.

@strelchm
Copy link
Contributor Author

strelchm commented Jan 30, 2022

Thanks much for response and project! I had mistake in my message (in asyncApiDocket method), i fixed it, the title now is "myproject"

@Crain-32
Copy link

Resolved in #75

@stavshamir
Copy link
Member

Finally fixed, will be available in the next release (will require ui update)

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

3 participants