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
use Mojolicious::Lite; post "/echo" => sub { my $c = shift->openapi->valid_input or return; my $data = { body => $c->req->json }; $c->stash( openapi => $data->{body} ); }, "echo"; plugin OpenAPI => { url => "data:///swagger.yaml", plugins => [qw(+Security)] }; app->start; __DATA__ @@ swagger.yaml openapi: "3.1.0" info: { version: "0.8", title: "Echo Service" } servers: - url: "/api" components: schemas: Potato: type: object properties: name: type: string responses: Potato: description: 'test' content: application/json: schema: allOf: - $ref: '#/components/schemas/Potato' - type: object properties: id: type: object securitySchemes: bearerAuth: type: http scheme: bearer bearerFormat: JWT description: default auth by JWT paths: /echo: post: x-mojo-name: "echo" requestBody: content: application/json: schema: type: "object" responses: 200: $ref: '#/components/responses/Potato' security: - bearerAuth: []
[potatogim@Potato-Arch]$ curl -XPOST -H 'Content-Type: application/json' -d '{"name": "test", "id": "test"}' http://localhost:3001/api/echo {"errors":[{"message":"\/allOf\/1 Expected object - got string.","path":"\/body\/id"}],"status":500}
AFAIK, OpenAPI supports the reusing responses defined under the components section but this response not validated properly.
[potatogim@Potato-Arch ~]$ curl -XPOST -H 'Content-Type: application/json' -d '{"name": "test", "id": "test"}' http://localhost:3001/api/echo {"id":"test","name":"test"}
The text was updated successfully, but these errors were encountered:
@jhthorsen Hello! 😄
First of all, sorry to bother you 😅
If there is anything wrong or strange, could you please give me some advice?
Sorry, something went wrong.
No branches or pull requests
Steps to reproduce the behavior
Expected behavior
Actual behavior
AFAIK, OpenAPI supports the reusing responses defined under the components section but this response not validated properly.
The text was updated successfully, but these errors were encountered: