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

TypeExtensions.GetOpenApiReferenceId does not support generics more than 1 level deep #666

Open
Arclights opened this issue Sep 19, 2024 · 0 comments

Comments

@Arclights
Copy link

Arclights commented Sep 19, 2024

Describe the issue
When declaring objects using generics that go more than one levels deep, the GetOpenApiReferenceId method will generate the same id, no matter what the inner classes are, due to the logic here.

This will result in that all the instances where the outer classes are the same, only one schema will be used in the resulting documentation.

To Reproduce
Assume that we have a common response model

class ResponseModel<T> {
   public T data {get; set;}
}

And two classes we want to respond with

class Foo {}

class Bar {}

And two functions with the following attributes

[OpenApiResponseWithBody(
        statusCode: HttpStatusCode.OK,
        contentType: MediaTypeNames.Application.Json,
        bodyType: typeof(ResponseModel<List<Foo>>)
)]

and

[OpenApiResponseWithBody(
        statusCode: HttpStatusCode.OK,
        contentType: MediaTypeNames.Application.Json,
        bodyType: typeof(ResponseModel<List<Bar>>)
)]

This will result in ResponseModel<List<Foo>> (if processed first) being used for documenting the response body of both functions

Expected behavior
ResponseModel<List<Foo>> for documenting the first function and ResponseModel<List<Bar>> for documenting the second one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant