We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
when we use form-data we can use it just as in sample:
openapi: 3.0.0 info: title: API version: v1 paths: /v1/auth/signup: post: tags: - Auth summary: Create user operationId: 'signup' requestBody: description: | Content-Type: multipart/form-data; boundary=boundary --boundary Content-Disposition: form-data; name="signup" { "firstName": "Andrey", "lastName": "Kim", "middleName": "Vladimirovich", "phone": "71111111111", "email": "[email protected]", "password": "mypassword", "passwordRepeat": "mypassword", "post": "CEO", "countryId": 10, "cityId": 11 } --boundary Content-Disposition: form-data; name="avatar"; filename="avatar.png"; < ./avatar.png --boundary-- content: multipart/form-data: schema: type: object properties: signup: $ref: '#/components/schemas/SignupRequest' required: true avatar: type: string format: binary responses: '200': description: 'Ok' content: application/json: schema: $ref: '#/components/schemas/Response' '422': description: 'Validation error' content: application/json: schema: $ref: '#/components/schemas/ValidationErrorResponse' '500': description: 'Internal Server Error' content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' components: schemas: Response: description: 'Basic response' required: - status - message - timestamp - success properties: status: description: Http status code type: integer message: description: Response message type: string timestamp: description: Response timestamp type: number format: int64 success: description: Response status type: boolean type: object ResponseList: description: 'Basic response list' required: - status - message - timestamp - success - totalCount properties: status: description: Http status code type: integer message: description: Response message type: string timestamp: description: Response timestamp type: number format: int64 success: description: Response status type: boolean totalCount: description: Response totlal list count type: integer type: object ErrorResponse: description: 'Error response' allOf: - $ref: '#/components/schemas/Response' - type: object properties: success: type: boolean default: false ValidationErrorResponse: description: 'Validation Error Response' allOf: - $ref: '#/components/schemas/ResponseList' - type: object properties: data: type: array items: $ref: '#/components/schemas/ErrorDetail' ErrorDetail: description: 'Error detail' required: - message - code properties: message: type: string description: Error message code: type: integer description: Error code type: object SignupRequest: type: object required: - firstName - lastName - phone - email - password - passwordRepeat - countryId - cityId - company properties: firstName: type: string lastName: type: string middleName: type: string phone: type: string example: 79999999999 email: type: string format: email password: type: string format: password passwordRepeat: type: string format: password post: type: string countryId: type: integer cityId: type: integer company: type: string interests: type: string
BUT if we just extract this request body to requestBodies block - generation will be failed:
openapi: 3.0.0 info: title: API version: v1 paths: /v1/auth/signup: post: tags: - Auth summary: Create user operationId: 'signup' requestBody: $ref: "#/components/requestBodies/UploadFile" responses: '200': description: 'Ok' content: application/json: schema: $ref: '#/components/schemas/Response' '422': description: 'Validation error' content: application/json: schema: $ref: '#/components/schemas/ValidationErrorResponse' '500': description: 'Internal Server Error' content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' components: requestBodies: UploadFile: description: | Content-Type: multipart/form-data; boundary=boundary --boundary Content-Disposition: form-data; name="signup" { "firstName": "Andrey", "lastName": "Kim", "middleName": "Vladimirovich", "phone": "71111111111", "email": "[email protected]", "password": "mypassword", "passwordRepeat": "mypassword", "post": "CEO", "countryId": 10, "cityId": 11 } --boundary Content-Disposition: form-data; name="avatar"; filename="avatar.png"; < ./avatar.png --boundary-- content: multipart/form-data: schema: type: object properties: signup: $ref: '#/components/schemas/SignupRequest' required: true avatar: type: string format: binary schemas: Response: description: 'Basic response' required: - status - message - timestamp - success properties: status: description: Http status code type: integer message: description: Response message type: string timestamp: description: Response timestamp type: number format: int64 success: description: Response status type: boolean type: object ResponseList: description: 'Basic response list' required: - status - message - timestamp - success - totalCount properties: status: description: Http status code type: integer message: description: Response message type: string timestamp: description: Response timestamp type: number format: int64 success: description: Response status type: boolean totalCount: description: Response totlal list count type: integer type: object ErrorResponse: description: 'Error response' allOf: - $ref: '#/components/schemas/Response' - type: object properties: success: type: boolean default: false ValidationErrorResponse: description: 'Validation Error Response' allOf: - $ref: '#/components/schemas/ResponseList' - type: object properties: data: type: array items: $ref: '#/components/schemas/ErrorDetail' ErrorDetail: description: 'Error detail' required: - message - code properties: message: type: string description: Error message code: type: integer description: Error code type: object SignupRequest: type: object required: - firstName - lastName - phone - email - password - passwordRepeat - countryId - cityId - company properties: firstName: type: string lastName: type: string middleName: type: string phone: type: string example: 79999999999 email: type: string format: email password: type: string format: password passwordRepeat: type: string format: password post: type: string countryId: type: integer cityId: type: integer company: type: string interests: type: string
in log we will see:
The following schema has undefined (null) baseType. It could be due to form parameter defined in OpenAPI v2 spec with incorrect consumes. A correct 'consumes' for form parameters should be 'application/x-www-form-urlencoded' or 'multipart/?' schema: class ObjectSchema { class Schema { type: object format: null $ref: null description: null title: null multipleOf: null maximum: null exclusiveMaximum: null minimum: null exclusiveMinimum: null maxLength: null minLength: null pattern: null maxItems: null minItems: null uniqueItems: null maxProperties: null minProperties: null required: null not: null properties: {signup=class Schema { type: null format: null $ref: #/components/schemas/SignupRequest description: null title: null multipleOf: null maximum: null exclusiveMaximum: null minimum: null exclusiveMinimum: null maxLength: null minLength: null pattern: null maxItems: null minItems: null uniqueItems: null maxProperties: null minProperties: null required: null not: null properties: null additionalProperties: null nullable: null readOnly: null writeOnly: null example: null externalDocs: null deprecated: null discriminator: null xml: null }, avatar=class BinarySchema { class Schema { type: string format: binary $ref: null description: null title: null multipleOf: null maximum: null exclusiveMaximum: null minimum: null exclusiveMinimum: null maxLength: null minLength: null pattern: null maxItems: null minItems: null uniqueItems: null maxProperties: null minProperties: null required: null not: null properties: null additionalProperties: null nullable: null readOnly: null writeOnly: null example: null externalDocs: null deprecated: null discriminator: null xml: null } }} additionalProperties: null nullable: null readOnly: null writeOnly: null example: null externalDocs: null deprecated: null discriminator: null xml: null } } codegenModel is null. Default to UNKNOWN_BASE_TYPE
and in code will be used UNKNOWN_BASE_TYPE:
/** * Create user * * @param UNKNOWN_BASE_TYPE Content-Type: multipart/form-data; boundary=boundary --boundary Content-Disposition: form-data; name=\"signup\" { \"firstName\": \"Andrey\", \"lastName\": \"Kim\", \"middleName\": \"Vladimirovich\", \"phone\": \"71111111111\", \"email\": \"[email protected]\", \"password\": \"mypassword\", \"passwordRepeat\": \"mypassword\", \"post\": \"CEO\", \"countryId\": 10, \"cityId\": 11 } --boundary Content-Disposition: form-data; name=\"avatar\"; filename=\"avatar.png\"; < ./avatar.png --boundary-- (optional) * @return Response */ suspend fun signup(UNKNOWN_BASE_TYPE: UNKNOWN_BASE_TYPE? = null) : Response
The text was updated successfully, but these errors were encountered:
No branches or pull requests
when we use form-data we can use it just as in sample:
BUT if we just extract this request body to requestBodies block - generation will be failed:
in log we will see:
and in code will be used UNKNOWN_BASE_TYPE:
The text was updated successfully, but these errors were encountered: