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

Added Micronaut configuration points #15005

Merged
merged 8 commits into from
Mar 29, 2023
Merged

Conversation

thrykol
Copy link
Contributor

@thrykol thrykol commented Mar 20, 2023

  • Allow specifying the Filter pattern when using authorization generation. This is necessary when generating code from more than one OpenAPI specification file.
  • Allow defining an ID in the declarative client. This is necessary for cases where various clients need to be configured differently (ie HTTP/2 vs HTTP/1.1)
  • Allow specifying a separator in the base path so configuration can be nested within the application's configuration

@bbdouglas @sreeshas @jfiala @lukoyanov @cbornet @jeff9finger @karismann @Zomzog @lwlee2608

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package 
    ./bin/generate-samples.sh
    ./bin/utils/export_docs_generators.sh
    
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*.
    For Windows users, please run the script in Git BASH.
  • In case you are adding a new generator, run the following additional script :
    ./bin/utils/ensure-up-to-date.sh
    
    Commit all changed files.
  • File the PR against the correct branch: master (6.3.0) (minor release - breaking changes with fallbacks), 7.0.x (breaking changes without fallbacks)
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

@wing328
Copy link
Member

wing328 commented Mar 23, 2023

thanks for the PR. please update the samples when you've time:

https://github.com/OpenAPITools/openapi-generator/actions/runs/4471940594/jobs/7857558673?pr=15005

cc @andriy-dmytruk

@thrykol
Copy link
Contributor Author

thrykol commented Mar 23, 2023

Sorry, I was sure I'd done that but guess not.

@Client(
{{#configureClientId}}id = "{{clientId}}",{{/configureClientId}}
path = "${{openbrace}}{{{applicationName}}}{{basePathSeparator}}base-path{{closebrace}}"
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you change it to

@Client({{#configureClientId}}
  id = "{{clientId}}",{{/configureClientId}}
  path = "${{openbrace}}{{{applicationName}}}{{basePathSeparator}}base-path{{closebrace}}"
)

so that there wouldn't be an extra line in the generated code?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thrykol Is there anyway of omitting the path? I'd like to specify a client id but keep the path in my application.yml.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The path is a property in the application.yml.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if you don't want to make use of the generated yml? I only want to generate the declarative client and specify the client id.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, yes I suppose it is better to set the URL with micronaut.http.services.{id}.url if the @Client(id=) is used. This supports all kinds of use cases.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would be the best way to achieve this @andriy-dmytruk? Adding an includePath config option which defaults to true?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably removing the path all along and simply make it configurable in the config by the client id would be the best.

@andriy-dmytruk
Copy link
Contributor

Otherwise, everything looks good to me

@thrykol
Copy link
Contributor Author

thrykol commented Mar 23, 2023

It would seem that ./bin/generate-samples.sh depends on ./mvnw package being run to pick up changes to the template files. That's probably what got me the first time around. I didn't find any documentation indicating such so might be a good thing to include in the PR template file.

@wing328
Copy link
Member

wing328 commented Mar 24, 2023

@thrykol can you please take a look at the circleci failure when you've time? https://app.circleci.com/pipelines/github/OpenAPITools/openapi-generator/22682/workflows/1b970176-8ecd-4498-81f7-8f49c3ccecc1/jobs/63308

it seems to be related to this change.

@thrykol thrykol requested a review from andriy-dmytruk March 28, 2023 19:07
Copy link
Contributor

@andriy-dmytruk andriy-dmytruk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks.
@wing328 Can you merge?

@wing328 wing328 added this to the 6.5.0 milestone Mar 29, 2023
@wing328 wing328 merged commit 0973795 into OpenAPITools:master Mar 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants