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

Missing schema name in swagger UI - addSchema API #364

Closed
guerrap opened this issue Feb 9, 2021 · 3 comments
Closed

Missing schema name in swagger UI - addSchema API #364

guerrap opened this issue Feb 9, 2021 · 3 comments

Comments

@guerrap
Copy link

guerrap commented Feb 9, 2021

You have already researched for similar issues?

Yes

What are you trying to achieve, or the steps to reproduce?

I'm defining schemas with the addSchema API, but they are displayed without a name in the swagger UI. There's an autogenerated name def-0.
I'm using the openapi option in the register configuration.

app.addSchema({
    $id: "mySchema",
    type: "object",
    properties: {
        prop: { type: "string" },
    },
});

What was the result you received?

image

What did you expect?

To see the $ids of the defined schemas as names in the UI. In this case, I expected to see a mySchema in the schemes list.
Is there something I am missing? In the docs and in the issues I couldn't find anyone reporting this, maybe there's something I'm doing wrong.

Context

  • node version: 14.8.0
  • fastify version: 3.11.0
  • os: Linux
@jsumners jsumners transferred this issue from fastify/help Feb 9, 2021
@mcollina
Copy link
Member

mcollina commented Feb 9, 2021

cc @climba03003 @Eomm could you take a look

@climba03003
Copy link
Member

You did nothing wrong, this is the current expected behavior for fastify-swagger.
You may keep a track on the following two issue or PR for this functionality
Eomm/json-schema-resolver#4
#337

@guerrap
Copy link
Author

guerrap commented Feb 9, 2021

Thank you for the quick response, I'm going to close this since it's duplicated

@guerrap guerrap closed this as completed Feb 9, 2021
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