Swagger-codegen: [C#] Generate with a given namespace

Created on 28 Nov 2016  Â·  5Comments  Â·  Source: swagger-api/swagger-codegen

I would like an option in swagger-codegen-cli that would generate a given namespace and not the default Swagger.IO since I sometimes integrate the generated code into an existing solution.

C-Sharp Suggestion

Most helpful comment

Have you reviewed the current options available for the C# client?

swagger-codegen|master⚡ ⇒ java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar config-help -l csharp

CONFIG OPTIONS
    packageName
        C# package name (convention: Title.Case). (Default: IO.Swagger)

    packageVersion
        C# package version. (Default: 1.0.0)

    sourceFolder
        source folder for generated code (Default: src)

    packageGuid
        The GUID that will be associated with the C# project

    targetFramework
        The target .NET framework version. (Default: v4.5)
            v3.5 - .NET Framework 3.5 compatible
            v4.5 - .NET Framework 4.5+ compatible
            uwp - Universal Windows Platform - beta support

    hideGenerationTimestamp
        Hides the generation timestamp. (Default: true)

    sortParamsByRequiredFlag
        Sort method arguments to place required parameters before optional parameters. (Default: true)

    useDateTimeOffset
        Use DateTimeOffset to model date-time properties (Default: false)

    useCollection
        Deserialize array types to Collection<T> instead of List<T>. (Default: false)

    returnICollection
        Return ICollection<T> instead of the concrete type. (Default: false)

    optionalMethodArgument
        C# Optional method argument, e.g. void square(int x=10) (.net 4.0+ only). (Default: true)

    optionalAssemblyInfo
        Generate AssemblyInfo.cs. (Default: true)

    optionalProjectFile
        Generate {PackageName}.csproj. (Default: true)

    optionalEmitDefaultValues
        Set DataMember's EmitDefaultValue. (Default: false)

    generatePropertyChanged
        Specifies a AssemblyDescription for the .NET Framework global assembly attributes stored in the AssemblyInfo file. (Default: false)

All 5 comments

Have you reviewed the current options available for the C# client?

swagger-codegen|master⚡ ⇒ java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar config-help -l csharp

CONFIG OPTIONS
    packageName
        C# package name (convention: Title.Case). (Default: IO.Swagger)

    packageVersion
        C# package version. (Default: 1.0.0)

    sourceFolder
        source folder for generated code (Default: src)

    packageGuid
        The GUID that will be associated with the C# project

    targetFramework
        The target .NET framework version. (Default: v4.5)
            v3.5 - .NET Framework 3.5 compatible
            v4.5 - .NET Framework 4.5+ compatible
            uwp - Universal Windows Platform - beta support

    hideGenerationTimestamp
        Hides the generation timestamp. (Default: true)

    sortParamsByRequiredFlag
        Sort method arguments to place required parameters before optional parameters. (Default: true)

    useDateTimeOffset
        Use DateTimeOffset to model date-time properties (Default: false)

    useCollection
        Deserialize array types to Collection<T> instead of List<T>. (Default: false)

    returnICollection
        Return ICollection<T> instead of the concrete type. (Default: false)

    optionalMethodArgument
        C# Optional method argument, e.g. void square(int x=10) (.net 4.0+ only). (Default: true)

    optionalAssemblyInfo
        Generate AssemblyInfo.cs. (Default: true)

    optionalProjectFile
        Generate {PackageName}.csproj. (Default: true)

    optionalEmitDefaultValues
        Set DataMember's EmitDefaultValue. (Default: false)

    generatePropertyChanged
        Specifies a AssemblyDescription for the .NET Framework global assembly attributes stored in the AssemblyInfo file. (Default: false)

Sorry, wasn't aware of this config existence.

How to add this config to generate command?

@mrleopoldus please refer to the project's README or the eBook "A Beginner's Guide to Code Generation for REST APIs"

@mrleopoldus please refer to the project's README or the eBook "A Beginner's Guide to Code Generation for REST APIs"

This is an Advertisement, is that really appropriate here?

Was this page helpful?
0 / 5 - 0 ratings