Skip to content

[NancyFx] Allow for override of PackageContext #6592

@craffael

Description

@craffael
Description

The current NancyFX generator constructs the C# namespace as follows: <packageName>.<packageContext>. Currently <packageContext> is set to a (sanitized) version of the swagger basepath.

In cases where the base path is non-simple, this can lead to strange namespaces. For example for packageName=company.security and basePath=/security.svc/v1 the resulting namespace would be company.security.security_svcv1 which is rather ugly.

Swagger-codegen version

Current master branch.

Command line used for generation

java -jar .\swagger-codegen-cli.jar generate -i ..\swagger\pos\swagger.yaml -l nancyfx -o . --additional-properties packageName=company.security

Suggest a fix/enhancement

I suggest to add a new nancyfx specific option called packageContext that allows us to overwrite the packageContext. I.e. we could use the command line

java -jar .\swagger-codegen-cli.jar generate -i ..\swagger\pos\swagger.yaml -l nancyfx -o . --additional-properties packageName=company.security,packageContext=v1

to get the namespace company.security.v1 which would be much nicer.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions