-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
[ASPNETCORE] Add support for central package version management #20192
Conversation
i don't think .net 9.0 is supported by the aspnetcore generator at the moment, and we welcome PRs with such enhancement. |
That wasn't on purpose. It was left from my changes regarding .net9. I corrected it Btw. can I set a PR to squash merge? |
pushed a commit with updated samples and docs. let's see how that goes |
can you please review the build errors (e.g. https://github.com/OpenAPITools/openapi-generator/actions/runs/12092892132/job/33723209893?pr=20192) when you've time? |
Done |
do you have Windows Subsystem for Linux (WSL) installed (assuming you're using Windows)? you can try to run the script to update the samples under WSL. |
Using WSL worked |
{{#centralizedPackageVersionManagementOptOut}} | ||
<ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally> | ||
{{/centralizedPackageVersionManagementOptOut}} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we simplify this to just one option (e.g. managePackageVersionsCentrally, which is a string, not boolean)?
{{#ManagePackageVersionsCentrally}}
<ManagePackageVersionsCentrally>{{{.}}}</ManagePackageVersionsCentrally>
{{/ManagePackageVersionsCentrally}}
if it's set to false
, add another additional properties skipVersion
for below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand you correctly that would mean when setting it to false it has a different behaviour than dont setting it at all?
Personally I dont like this. As a user I would expect that if I dont set it at all it would do the same as false. If you want to have only one option though, we could use a enum with "true", "opt-out", "default". Not setting it would use the default option
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a user I would expect that if I dont set it at all it would do the same as false
we can default the option to false
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could, but not having the property in the .csproj file and setting the property to false are very different things
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
we could use a enum with "true", "opt-out", "default". Not setting it would use the default option
what about having 3 values in a single option instead as you suggested earlier?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've fixed the option and filed #20401
Here is what the error message looks like:
[main] WARN o.o.c.languages.AspNetServerCodegen - ASP.NET core version is 8.0 so changing to use frameworkReference instead of packageReference
Exception in thread "main" java.lang.RuntimeException: Invalid value `something` for the option `centralizedPackageVersionManagement`. Please refer to the documentation for more information.
at org.openapitools.codegen.languages.AspNetServerCodegen.processOpts(AspNetServerCodegen.java:497)
at org.openapitools.codegen.DefaultGenerator.configureGeneratorProperties(DefaultGenerator.java:261)
at org.openapitools.codegen.DefaultGenerator.generate(DefaultGenerator.java:1288)
at org.openapitools.codegen.cmd.Generate.execute(Generate.java:535)
at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
Can you please take a look when you've time?
I think you will need to make some more updates.
Can you pull the latest and submit new PRs targeting `Urganot-central-package-version-management-option instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure.
I dont understand what you did here. why is this enum so dofferent from all other enums?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no idea. i simply copied the implementation (option of enum values) from other generators.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how can this be? doesnt this imply that something is wrong? either with how enums are handled generally or in aspnetcore specifically?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as I said I didn't debug your code, I simply copied a working implementation from another generator that's proven to be working (with correctly validation)
in other words, we can go with a working implementation instead of reinventing the wheel.
* [C] Deprecate *_create() to avoid *_free() confusion The behaviour of *_free() doesn't match *_create(), so the user should avoid using them together. But they still need *_free() to clean up library-allocated objects, so add a _library_owned flag to each struct as an attempt to tell them apart. This isn't perfect though, because the user may neglect to zero the field, but they would still see a warning once in a while so it serves its purpose. To prevent the new deprecation warnings (intended for the user) from showing up during the library build itself, define a new family of *_create_internal() functions, and turn *_create() into simple wrappers. * Update samples * add eafer to c technical committee --------- Co-authored-by: William Cheng <[email protected]>
Manage colon converting to underscore on sanitize
* Adds @nullable annotation to Spring Boot generator * issue-14427: [REQ][spring] Null-Safety annotations * issue-17382: [REQ] spring generator add Nullable annotations Motivations: * Have Spring Boot generator client properly annotated for nullability to be able to check code using them with tools like NullAway * As it is related to Spring then the `org.springframework.lang.Nullable` annotation was chosen to avoid discussion which `@Nullable` one is true one * `@NonNull` wasn't used as I didn't see much benefit of it. Anyhow, an empty constructor and/or setters allow to put a `null` value there Modifications: * Adds nullableAnnotation template to handle nullability annotation on vars * Adjust pojo templates to use the nullability template * Adapts tests Modifications: * Runs export_docs_generator.sh script to update samples * samples update * excludes Spring @nullable from java-camel * ones with defaults shouldn't be annotated as @nullable * updates samples * adds AllArgConstructor generation tests * adds container tests
#20403) * Fixed default value for usePackageVersions * Regenerated docs
This pr adds support for using centralized package version management.
For this two options were added:
Setting useCentralizedPackageVersionManagement true will add the
ManagePackageVersionsCentrally
property to the csproj file, set the value to true and remove explicit versions from packagesSetting useCentralizedPackageVersionManagement true will add the
ManagePackageVersionsCentrally
property to the csproj file and set the value to falseTemplate files for both kinds of projects were updated accordingly.
A sample with
useCentralizedPackageVersionManagement: true
was addedTechnical Committee mentions:
@mandrean @shibayan @Blackclaws @lucamazzanti @iBicha
PR checklist
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*
.IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
master
(upcoming7.x.0
minor release - breaking changes with fallbacks),8.0.x
(breaking changes without fallbacks)