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

Handle multipart/form-data parameters #9

Merged
merged 1 commit into from
Mar 17, 2023
Merged

Handle multipart/form-data parameters #9

merged 1 commit into from
Mar 17, 2023

Conversation

distantcam
Copy link
Contributor

Refitter was creating anonymous types for endpoints I had that take multipart/form-data bodies.

@christianhelle
Copy link
Owner

@distantcam Thanks for this contribution

Do you have an example OpenAPI spec that uses this? Just a short snippet is fine.

@kgamecarter made a pull request yesterday that includes an example snippet of an OpenAPI spec that fails and a snippet of the incorrectly generated code

@christianhelle christianhelle merged commit eb2a649 into christianhelle:main Mar 17, 2023
@christianhelle
Copy link
Owner

christianhelle commented Mar 17, 2023

I found some errors in the generated interface when using the Swagger Petstore v2 OpenAPI spec example that causes the smoke tests to fail

It generates this:

[Get("/pet/findByStatus")]
Task<ICollection<Pet>> FindPetsByStatus([Query(CollectionFormat.Multi)]Anonymous? status);

instead of this:

[Get("/pet/findByStatus")]
Task<ICollection<Pet>> FindPetsByStatus([Query(CollectionFormat.Multi)]Status? status);

I merged this in and will fix v2 spec issue myself

@christianhelle christianhelle requested review from christianhelle and removed request for christianhelle March 17, 2023 08:33
@christianhelle christianhelle added the bug Something isn't working label Mar 17, 2023
@christianhelle christianhelle self-assigned this Mar 17, 2023
@christianhelle
Copy link
Owner

Apparently, it's an NSwag thing. The enum contract is also generated as:

public enum Anonymous
{
    [System.Runtime.Serialization.EnumMember(Value = @"available")]
    Available = 0,

    [System.Runtime.Serialization.EnumMember(Value = @"pending")]
    Pending = 1,

    [System.Runtime.Serialization.EnumMember(Value = @"sold")]
    Sold = 2,
}

So its either I fix it on the NSwag or I switch to another OpenAPI parser and generate the contracts myself

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants