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

[csharp] Move nullable reference types switch to abstract #9661

Merged

Conversation

devhl-labs
Copy link
Contributor

Moving the nullable reference types switch from aspnet generator to abstract so all csharp can use it.

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, 5.1.x, 6.0.x
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

@mandrean @frankyjuang @shibayan @Blackclaws @wing328

@wing328
Copy link
Member

wing328 commented Jun 3, 2021

@devhl-labs thanks for the PR as always.

Do we also need to update the mustache templates to actually use the option (the mustache tag)?

In other words, if we move the option to the C# abstract class, we need to make sure all C# generators that inherit the abstract generator properly support the option. Otherwise, we can only add the option to individual generators to start with.

@devhl-labs
Copy link
Contributor Author

devhl-labs commented Jun 3, 2021

Yes, it would have to be handled by each set of template files. If we don't put it in the abstract, then we are removing the option for users to use their own custom templates to handle this option for generators that don't support it yet. We would also be adding more work for users who want to do a PR to add the feature to mustache files.

#9643
Here is another request for nullables. If this pr doesn't fix their issue, then at least we could tell the user that using a custom template is an option.

But if you really want each generator to implement it individually, please tell me.

@Blackclaws
Copy link
Contributor

I think that, technically, there is no need to actually change any part of the templates aside from the csproj files to use this. The reason is that with nullable reference types you simply change the post process function to treat every type as nullable and voila you get a nullable reference annotation for each type that is optional

@devhl-labs
Copy link
Contributor Author

I can add it to the csproj files later today.

@wing328
Copy link
Member

wing328 commented Jun 4, 2021

I think that, technically, there is no need to actually change any part of the templates aside from the csproj files to use this.

Yes, that what I meant, e.g. https://github.com/OpenAPITools/openapi-generator/pull/9620/files#diff-b62dd64c4e02abc058c477127e8c9c85250c66b616d6683c9ee143470bcf2cd9R10

@devhl-labs
Copy link
Contributor Author

Im tracking i just didnt get to it today.

@devhl-labs
Copy link
Contributor Author

devhl-labs commented Jun 6, 2021

Aspnetcore was already handled. Skipped dotnet-core2 because it's deprecated. Skipped nancyfx because the framework itself is deprecated as far as I can tell. Added to csharp-netcore.

I'm guessing the checks just need to be restarted after the docker rate limit is over.

@wing328
Copy link
Member

wing328 commented Jun 8, 2021

Can you please resolve the merge conflicts when you've time?

@devhl-labs
Copy link
Contributor Author

Done

@devhl-labs
Copy link
Contributor Author

I see drone had an unrelated error. Is that why app veyor failed?

@wing328
Copy link
Member

wing328 commented Jun 9, 2021

@wing328 wing328 merged commit 46f8a67 into OpenAPITools:master Jun 9, 2021
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.

3 participants