question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@Schema(hidden = true) does not work with data model class

See original GitHub issue

Hi, I am Hanna Buklis, backend developer. I started using springdoc-openapi-ui on my current project a few days ago. I faced the following issue: I cannot hide on certain schema from ‘Schemas’ list in ui section. Schemas list: image

I checked documentation, it looks like @Schema(hidden = true) should hide a class from the list above.

My setup: Spring Boot 2.2.6.RELEASE springdoc-openapi: 1.4.3 springdoc-openapi-data-rest: 1.4.3

Entity class which I want to hide:

@AllArgsConstructor
@NoArgsConstructor
@Schema(hidden = true)
public class FailedUser {
    @Id
    private String id;
}

Application properties : springdoc.api-docs.resolve-schema-properties=true springdoc.api-docs.enabled=true springdoc.api-docs.path=/doc/definition springdoc.swagger-ui.path=/doc/docs springdoc.swagger-ui.supportedSubmitMethods=[“get”]

After this configuration, I expect FailedUser to be absent in ‘Schemas’ list. But it is still in place. Could you please tell me if this is a bug or wrong configuration?

Thank you in advance.

Best regards, Hanna Buklis.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jlorenzoCcommented, Oct 23, 2020

@bnasslahsen thanks bro. Issue solved! You helped me to solve the issue. The problem was that the controller of the model A wasn’t referencing it like you just showed me. Thanks a lot!

1reaction
bnasslahsencommented, Oct 23, 2020

@jlorenzoC,

You have a lot of samples for test controllers in the project tests. For example, the code here:

If you have any other question, please make sure you provide the requested code samples.

Read more comments on GitHub >

github_iconTop Results From Across the Web

FastAPI - @Schema(hidden=True) not working when trying to ...
I've checked the docs and tried this but the schema section still shows. @Schema(hidden=True) class theSchema(BaseModel): category: str.
Read more >
Hide a Request Field in Swagger API - Baeldung
A quick and practical guide to hiding a request field in Swagger UI.
Read more >
F.A.Q - Springdoc-openapi
How can I ignore some field of model ? You can use the following annotation on the top of the field that you...
Read more >
springdoc-openapi (Spring Boot) - Google Sites
The springdoc-openapi Java library helps automating the generation of API documentation using Spring Boot projects. It's an alternative to Springfox (which ...
Read more >
Mongoose v6.8.0: Schemas
This is because empty query filters cause Mongoose to return all documents in the model, which can cause issues. const mySchema = new...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found