Skip to content

[aspnetcore] Added parameter to generate models in a seperate csproj#13024

Merged
wing328 merged 3 commits intoOpenAPITools:masterfrom
knom:aspnetcore-model-package
Jul 30, 2022
Merged

[aspnetcore] Added parameter to generate models in a seperate csproj#13024
wing328 merged 3 commits intoOpenAPITools:masterfrom
knom:aspnetcore-model-package

Conversation

@knom
Copy link
Contributor

@knom knom commented Jul 26, 2022

@wing328

[aspnetcore] Added parameter to generate models in a seperate csproj

Now a seperate CSPROJ can be generated for MODELS.

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.
  • File the PR against the correct branch: master (6.1.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 Jul 29, 2022

@knom thanks for the PR. Can you please elaborate on the use case for this option?

cc @mandrean (2017/08) @frankyjuang (2019/09) @shibayan (2020/02) @Blackclaws (2021/03) @lucamazzanti (2021/05)

{
supportingFiles.add(new SupportingFile("ModelsProject.csproj.mustache", sourceFolder + File.separator + modelPackage, modelPackage + ".csproj"));
}

Copy link
Member

Choose a reason for hiding this comment

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

can you please update the Java code to conform the java code style? e.g.

if (...) {
    // do something
} else {
    // do something else
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fine @wing328 I've refactored the IF/ELSEs

@knom
Copy link
Contributor Author

knom commented Jul 29, 2022

@knom thanks for the PR. Can you please elaborate on the use case for this option?

cc @mandrean (2017/08) @frankyjuang (2019/09) @shibayan (2020/02) @Blackclaws (2021/03) @lucamazzanti (2021/05)

In C# some folks like to have MODELS in a seperate C# project from the CONTROLLERS and stuff.
That is for better structuring - and reuse of the models.

The new switch will generate 2 projects:

  • 1 default project (Controllers, startup.cs, ...)
  • 1 project just for models

@wing328
Copy link
Member

wing328 commented Jul 30, 2022

Thanks for the explanation. Let's give it a try.

@wing328 wing328 added this to the 6.1.0 milestone Jul 30, 2022
@wing328 wing328 merged commit c81a63f into OpenAPITools:master Jul 30, 2022
@knom
Copy link
Contributor Author

knom commented Jul 30, 2022

I guess we'd probably need special sample generators and CI test..

I tried to do that in #13044.
Please let me know what you think!

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.

2 participants