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

Support Fluent Setters for Annotations #1817

Open
funkrusher opened this issue Apr 27, 2024 · 0 comments
Open

Support Fluent Setters for Annotations #1817

funkrusher opened this issue Apr 27, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@funkrusher
Copy link

funkrusher commented Apr 27, 2024

it seems, that currently only regular setters are scanned/resolved for Annotations (Schema, SchemaProperty). For example:

The following setter method is recognized in my quarkus service, that uses smallrye-open-api, and it will show in the swagger-ui (in the examples area of swagger), like defined here:

Normal Setter:

@Schema(name = "createdAt", example = "1618312800000", type = SchemaType.NUMBER, format = "date-time", description = "Timestamp in milliseconds since 1970-01-01T00:00:00Z")
    public void setCreatedAt(LocalDateTime value);

It is often very convenient to use "fluent setters", which return the Class instance to make fluent setter calls possible. If not know, i want to show this convenience in following example:

Product product = new Product()
    .setCreatedAt(123433434L)
    .setTitle("test")
    .setType(3);

The JSON Library Jackson does correctly recognize those fluent setters, so it seems that some libraries already support them. The jOOQ Library (Object Oriented Queries) also is able to create fluent setters into the code.

Following example does not seem to be recognized by smallrye-open-api, as it does not show up in the swagger-ui:

Fluent Setter:

@Schema(name = "createdAt", example = "1618312800000", type = SchemaType.NUMBER, format = "date-time", description = "Timestamp in milliseconds since 1970-01-01T00:00:00Z")
    public IProduct setCreatedAt(LocalDateTime value);

It would be cool if you could consider making this possible :) thanks in advance.

@MikeEdgar MikeEdgar added the enhancement New feature or request label Apr 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants