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

@AsyncOperation.Headers.Header#value is mandatory and renders as "enum" #791

Closed
ccudennec-otto opened this issue Jun 6, 2024 · 7 comments · Fixed by #798
Closed

@AsyncOperation.Headers.Header#value is mandatory and renders as "enum" #791

ccudennec-otto opened this issue Jun 6, 2024 · 7 comments · Fixed by #798
Labels
bug Something isn't working good first issue Good for newcomers staged for release

Comments

@ccudennec-otto
Copy link
Contributor

Describe the bug
When I want to document the headers of my operation, I need to specify the "value" of the header, e.g.:

@AsyncOperation.Headers.Header(name = "ce_id", value="foo" description = "CloudEvent Id")

This will render as the following YAML:

        ce_id:
          type: string
          description: CloudEvent Id
          enum:
            - foo
          examples:
            - foo

By defining the list of possible values using "enum" it should not be possible to send different values than the one defined.
IMHO it should be possible to not define Header#value if the value is dynamic.
Did I misread the specification?

Dependencies and versions used
springwolf-core version 1.2.0.

Thanks!

Christopher

@ccudennec-otto ccudennec-otto added the bug Something isn't working label Jun 6, 2024
Copy link

github-actions bot commented Jun 6, 2024

Welcome to Springwolf. Thanks a lot for reporting your first issue. Please check out our contributors guide and feel free to join us on discord.

@sam0r040 sam0r040 added the good first issue Good for newcomers label Jun 7, 2024
@timonback
Copy link
Member

Hi fellow OTTO colleague @ccudennec-otto,

supporting dynamic values is a very good addition.

We can imagine the following:

  • Giving the value property of the annotation [0] a default, so that it can be left empty and is mapped neither to examples nor into the enum
  • Removing the mapping of values to the enum entirely
  • Or, alternatively introduce a new property pattern[1], which has an empty default as well. If it is set, it is mapped into the asyncapi schema; no enum. If it is not set, the enum is populated - as it is right now.

We are happy for any contribution.

[0] https://github.com/springwolf/springwolf-core/blob/master/springwolf-core/src/main/java/io/github/springwolf/core/asyncapi/annotations/AsyncOperation.java
[1] https://www.asyncapi.com/docs/reference/specification/v3.0.0#schemaObject

@ccudennec-otto
Copy link
Contributor Author

Hi @timonback!
Thanks for your comments! I'll try to come up with a PR for your first idea. We can go through the other ideas as well.
Cheers and have a nice weekend!
Christopher

Copy link

The change is staged for release and will be part of the next release.

If you want to try and verify it in your application today,
use the latest 1.X.0-SNAPSHOT build as described in our README.md > Testing SNAPSHOT version

Thank you for the report/contribution!

@timonback
Copy link
Member

timonback commented Jun 10, 2024

PR looks great and is merged now.
Thank you for the contribution @ccudennec-otto !

The next release is planned for the last Friday of the month.

If you are interested in additionally documenting a pattern instead of an empty header value, you are very much welcome to re-use this issue and open a new PR.

@ccudennec-otto
Copy link
Contributor Author

PR looks great and is merged now.

Awesome, thanks @timonback !

I will come back to you when I run into the issue that I need the pattern. At the moment my priority is to see that the result is rendered in Backstage. I will close this issue for now.

Thanks for your support and quick feedback!

Christopher

Copy link

The change is available in the latest release. 🎉

Thank you for the report/contribution and making Springwolf better!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers staged for release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants