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

Feature: Support Request Parts #271

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

belljun3395
Copy link

@belljun3395 belljun3395 commented Sep 7, 2024

Related Isssue: #105 , #205

I am not good at English.
If there's anything you don't understand, please leave a comment.

I know swagger and postman support file type.

- Swagger
스크린샷 2024-09-07 오후 3 06 58

- Postman
스크린샷 2024-09-07 오후 3 07 19

So I wrote the code to implement to support request with file.

RequestModel

private data class RequestModel(
    ....
    val requestParts: List<OperationRequestPart>,
)

Add requestParts for multipart request.

FileSchema, FormData

class FileSchema(
    builder: BinarySchemaBuilder
) : StringSchema(builder) {
    ...
    val format: String
}
@JsonPropertyOrder({
    "key",
    "type",
    "src",
    "description",

})
public class FormData {
    ....
}

Make FileSchema/FormData for OpenApiGenerator/PostmanGenerator to handle spec for file type.

In Generator they are added to RequestModel and Body

data class RequestModel(
    ...
    // FileSchema -> RequestPartFieldDescriptor
    val requestParts: List<RequestPartFieldDescriptor>,
)
@JsonPropertyOrder({
    "mode",
    "raw",
    "urlencoded",
    "formdata"
})
public class Body  { ... }

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

Successfully merging this pull request may close these issues.

1 participant