Skip to content

Conversation

@alfredo-accuris
Copy link
Contributor

The generated code of Csharp get a fully quallify namespace for PATH

using Path = global::System.IO.Path;

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/configs/*.yaml
    ./bin/utils/export_docs_generators.sh
    
    (For Windows users, please run the script in Git BASH)
    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.
  • File the PR against the correct branch: master (upcoming 7.6.0 minor release - breaking changes with fallbacks), 8.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.
    @mandrean @shibayan @Blackclaws @lucamazzanti @iBicha

The generated code of Csharp get a fully quallify namespace for PATH

using Path = global::System.IO.Path;
@alfredo-accuris
Copy link
Contributor Author

Intends to fix #19344

using RestSharp.Serializers;
using RestSharpMethod = RestSharp.Method;
using FileIO = System.IO.File;
using Path = global::System.IO.Path;
Copy link
Contributor

Choose a reason for hiding this comment

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

Using an alias might lead to more conflicts with other apis that have objects called Path. Please just fully qualify the Path method without using an alias.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Update the PR. Fully qualify Path class

Copy link
Member

Choose a reason for hiding this comment

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

using RestSharpMethod = RestSharp.Method;
using FileIO = System.IO.File;

given that we're already using aliases above, shall we follow the same pattern for Path to make it consistent? e.g.

using PathIO = System.IO.Path;

Copy link
Contributor

@devhl-labs devhl-labs Aug 24, 2024

Choose a reason for hiding this comment

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

I do not think we should be using aliases. That will make it easier for unexpected conflicts to occur. Using the fully qualified name is more verbose, but also more concise. We don't care about verbosity here because it is generated code anyway.

Copy link
Member

Choose a reason for hiding this comment

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

We don't care about verbosity here because it is generated code anyway.

some users do care about it based on feedback we'd previously when using fully qualified namespace

i don't think giving this one a try

@wing328
Copy link
Member

wing328 commented Aug 19, 2024

thanks for the PR

with name mapping option for fallback, can this PR target upcoming minor release (breaking with fallback allowed)?

ref: https://github.com/openapitools/openapi-generator/blob/master/docs/customization.md#name-mapping

@devhl-labs
Copy link
Contributor

This is not a breaking change. It is only fully qualifying a method, a very safe thing to do. I don't see any harm in merging it now.

@wing328 wing328 added this to the 7.9.0 milestone Aug 21, 2024
@wing328 wing328 modified the milestones: 7.9.0, 7.10.0 Oct 8, 2024
@wing328 wing328 merged commit 9452873 into OpenAPITools:master Oct 30, 2024
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