Skip to content

Instantly share code, notes, and snippets.

@jjn1056
Last active February 5, 2019 19:37
Show Gist options
  • Save jjn1056/7d981a205d3b183ccb88bdbbd8ad3e40 to your computer and use it in GitHub Desktop.
Save jjn1056/7d981a205d3b183ccb88bdbbd8ad3e40 to your computer and use it in GitHub Desktop.
package MyApp;
use Catalyst 'OpenAPI';
__PACKAGE__->config(
'Plugin::OpenAPI' => {
# global settings;
},
);
package MyApp::Controller::User;
use MyApp::Controller;
sub users
:openAPI({
summary: 'Returns worlds by name.',
operationId: 'getWorlds',
parameters: [
{
in: 'query',
name: 'worldName',
required: true,
type: 'string'
}
],
responses: {
200: {
description: 'A list of worlds that match the requested name.',
schema: {
type: 'array',
items: {
$ref: '#/definitions/World'
}
}
},
default: {
description: 'An error occurred',
schema: {
additionalProperties: true
}
}
}
}) ($self, $c) {
## Stuff to handle the endpoint
}
sub users_200 :OpenAPI { ... }
sub users_default :OpenAPI { ... }
__PACKAGE__->meta->make_immutable(1);
@jjn1056
Copy link
Author

jjn1056 commented Feb 4, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment