Closed mortifactor closed 1 year ago
Hello! First of all thank you for such a great tool.
Here is a snippet of an openapi scheme that is generated by my asp net web api that causes an error:
openapi: 3.0.1 info: title: ParkingMobileApi version: '1.0' paths: /api/paymentmethod/list: post: tags: - ParkingMobile responses: '200': description: Success content: text/plain: schema: $ref: '#/components/schemas/PaymentMethodsViewModel' application/json: schema: $ref: '#/components/schemas/PaymentMethodsViewModel' text/json: schema: $ref: '#/components/schemas/PaymentMethodsViewModel' components: schemas: BankCardStatusViewModel: required: - pan - recurringId type: object properties: recurringId: type: string pan: type: string additionalProperties: false PaymentMethodsViewModel: type: object properties: sbpSubscriptions: type: array items: $ref: '#/components/schemas/SbpSubscriptionStatusViewModel' nullable: true bankCards: type: array items: $ref: '#/components/schemas/BankCardStatusViewModel' nullable: true additionalProperties: false SbpSubscriptionStatusViewModel: required: - bankName - subscriptionId type: object properties: subscriptionId: type: string bankName: type: string additionalProperties: false securitySchemes: Bearer: type: http description: Please insert JWT token into field scheme: bearer bearerFormat: JWT security: - Bearer: [ ]
And when I make an api call I receive an error:
Client error - operationID: post/api/paymentmethod/list, operationInput: Input(path: authtest.Operations.post_api_paymentmethod_list.Input.Path(), query: authtest.Operations.post_api_paymentmethod_list.Input.Query(), headers: authtest.Operations.post_api_paymentmethod_list.Input.Headers(accept: [OpenAPIRuntime.AcceptHeaderContentType<authtest.Operations.post_api_paymentmethod_list.AcceptableContentType>(contentType: authtest.Operations.post_api_paymentmethod_list.AcceptableContentType.json, quality: OpenAPIRuntime.QualityValue(thousands: 1000))]), cookies: authtest.Operations.post_api_paymentmethod_list.Input.Cookies(), body: nil), request: path: /api/paymentmethod/list, query: <nil>, method: HTTPMethod(value: OpenAPIRuntime.HTTPMethod.(unknown context at $104b797e8).OpenAPIHTTPMethod.POST), header fields: [accept: application/json], body (prefix): <nil>, baseURL: http://192.168.24.54:6044, response: status: 200, header fields: [Server: Kestrel, Content-Type: application/json; charset=utf-8, Transfer-Encoding: Identity, Date: Mon, 28 Aug 2023 02:43:31 GMT], body: [], underlying error: DecodingError: typeMismatch Dictionary<String, Any> - at : Expected to decode Dictionary<String, Any> but found an array instead. (underlying error: <nil>)
Just in case, my underlying c# class:
public class PaymentMethodsViewModel { public IEnumerable<SbpSubscriptionStatusViewModel> SbpSubscriptions { get; set; } public IEnumerable<BankCardStatusViewModel> BankCards { get; set; } }
Is my scheme not correct? Or this might be a bug?
Thank you!
Oops. My bad. I was returning wrong type in my server code. Sorry! And thank you again.
Hello! First of all thank you for such a great tool.
Here is a snippet of an openapi scheme that is generated by my asp net web api that causes an error:
And when I make an api call I receive an error:
Client error - operationID: post/api/paymentmethod/list, operationInput: Input(path: authtest.Operations.post_api_paymentmethod_list.Input.Path(), query: authtest.Operations.post_api_paymentmethod_list.Input.Query(), headers: authtest.Operations.post_api_paymentmethod_list.Input.Headers(accept: [OpenAPIRuntime.AcceptHeaderContentType<authtest.Operations.post_api_paymentmethod_list.AcceptableContentType>(contentType: authtest.Operations.post_api_paymentmethod_list.AcceptableContentType.json, quality: OpenAPIRuntime.QualityValue(thousands: 1000))]), cookies: authtest.Operations.post_api_paymentmethod_list.Input.Cookies(), body: nil), request: path: /api/paymentmethod/list, query: <nil>, method: HTTPMethod(value: OpenAPIRuntime.HTTPMethod.(unknown context at $104b797e8).OpenAPIHTTPMethod.POST), header fields: [accept: application/json], body (prefix): <nil>, baseURL: http://192.168.24.54:6044, response: status: 200, header fields: [Server: Kestrel, Content-Type: application/json; charset=utf-8, Transfer-Encoding: Identity, Date: Mon, 28 Aug 2023 02:43:31 GMT], body: [], underlying error: DecodingError: typeMismatch Dictionary<String, Any> - at : Expected to decode Dictionary<String, Any> but found an array instead. (underlying error: <nil>)
Just in case, my underlying c# class:
Is my scheme not correct? Or this might be a bug?
Thank you!