Last active
April 8, 2019 10:35
-
-
Save patrickbkr/086624cf82d69028ddddfb27bd5cc790 to your computer and use it in GitHub Desktop.
Cro::OpenAPI::RoutesFromDefinition calling the wrong handler
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
SMP_APP_HOST=localhost SMP_APP_PORT=20000 perl6 service.p6 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Cro::HTTP::Server; | |
use Cro::HTTP::Router; | |
use Cro::OpenAPI::RoutesFromDefinition; | |
sub routes() is export { | |
openapi 'smp-openapi.yaml'.IO, { | |
operation 'anschriftPerIdAbrufen', -> { | |
say "In operation handler!"; | |
content 'application/json', %(Name => 'Daniel'); | |
} | |
} | |
} | |
my Cro::Service $http = Cro::HTTP::Server.new( | |
http => <1.1>, | |
host => %*ENV<SMP_APP_HOST> || | |
die("Missing SMP_APP_HOST in environment"), | |
port => %*ENV<SMP_APP_PORT> || | |
die("Missing SMP_APP_PORT in environment"), | |
application => routes(), | |
); | |
$http.start; | |
say "Listening at http://%*ENV<SMP_APP_HOST>:%*ENV<SMP_APP_PORT>"; | |
react { | |
whenever signal(SIGINT) { | |
say "Shutting down..."; | |
$http.stop; | |
done; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
openapi: "3.0.0" | |
info: | |
title: "HALTEC SMP-App" | |
version: "1.0.0" | |
paths: | |
/anschrift: | |
get: | |
operationId: "anschriftPerIdAbrufen" | |
responses: | |
200: | |
description: "erfolgreich" | |
content: | |
application/json: | |
schema: | |
$ref: "#/components/schemas/Anschrift" | |
components: | |
schemas: | |
Anschrift: | |
type: "object" | |
required: | |
- "Rufname" | |
properties: | |
ID: | |
type: "integer" | |
format: "int64" | |
Rufname: | |
type: "string" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment