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] Return types don't match generated model names #665

Closed
timosnel opened this issue Apr 20, 2015 · 3 comments
Closed

[csharp] Return types don't match generated model names #665

timosnel opened this issue Apr 20, 2015 · 3 comments

Comments

@timosnel
Copy link

I'm using swagger-codegen to generate a C# client. In my swagger spec my types include their full namespace because I have classes with the same name spread across different namespaces.

For example I could have a definition for Example.Store.Product in my swagger spec:

"definitions": {
    "Example.Store.Product": {
        "type": "object",
        "properties": {
            "Title": {
                "type": "string"
            },
            "LanguageCode": {
                "type": "string"
            }
        }
    }
}

This will generate a ExampleStoreProduct model as follows:

namespace io.swagger.Model {
    public class ExampleStoreProduct {
        // Properties
    }
}

However, in the generated Api file the return type will be Example.Store.Product, which obviously not does compile.

public Example.Store.Product Product_GetProducts () {
    // code
}

I'm using version 2.1.0-M2 and a Swagger 2.0 spec.

@wing328
Copy link
Contributor

wing328 commented Apr 21, 2015

@Snelbinder I've filed a PR #668 to fix the issue. I did some tests and the generated code looks good (e.g the return type is PetTest instead of Pet.Test).

@timosnel
Copy link
Author

@wing328 Tested it and it all seems to work now, thanks for the quick fix!

@fehguy
Copy link
Contributor

fehguy commented Apr 21, 2015

great, thank you

@fehguy fehguy closed this as completed Apr 21, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants