Skip to content

Commit

Permalink
Response for individual operations (#426)
Browse files Browse the repository at this point in the history
* Improved return-response tests

Signed-off-by: Helber Belmiro <[email protected]>

* Return `Response` instead of `void` (#386)

* Apply suggestions from code review

* Apply suggestions from code review

---------

Signed-off-by: Helber Belmiro <[email protected]>
Co-authored-by: Helber Belmiro <[email protected]>
  • Loading branch information
mzellho and hbelmiro authored Aug 15, 2023
1 parent 7e7ef61 commit 6a4c99f
Show file tree
Hide file tree
Showing 11 changed files with 1,719 additions and 12 deletions.
6 changes: 5 additions & 1 deletion deployment/src/main/resources/templates/api.qute
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public interface {classname} {
public io.smallrye.mutiny.Uni<jakarta.ws.rs.core.Response> {op.nickname}(
{#else}
{#if op.returnType == "void"}
public {#if op.returnType}io.smallrye.mutiny.Uni<Void>{#else}io.smallrye.mutiny.Uni<jakarta.ws.rs.core.Response>{/if} {op.nickname}(
public io.smallrye.mutiny.Uni<jakarta.ws.rs.core.Response> {op.nickname}(
{#else}
public {#if op.returnType}io.smallrye.mutiny.Uni<{op.returnType}>{#else}io.smallrye.mutiny.Uni<jakarta.ws.rs.core.Response>{/if} {op.nickname}(
{/if}
Expand All @@ -85,7 +85,11 @@ public interface {classname} {
{#if return-response}
public jakarta.ws.rs.core.Response {op.nickname}(
{#else}
{#if op.returnType == "void"}
public jakarta.ws.rs.core.Response {op.nickname}(
{#else}
public {#if op.returnType}{op.returnType}{#else}jakarta.ws.rs.core.Response{/if} {op.nickname}(
{/if}
{/if}
{/if}
{#if op.hasFormParams}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,274 @@
---
openapi: 3.0.3
info:
title: greeting-flow API
version: "1.0"
paths:
/:
post:
requestBody:
content:
'*/*':
schema:
$ref: '#/components/schemas/CloudEvent'
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Response'
/hello:
get:
tags:
- MutinyReturnResponseFalseString
operationId: hello
responses:
"200":
description: OK
content:
text/plain:
schema:
type: string
/messaging/topics:
get:
tags:
- Quarkus Topics Information Resource
responses:
"200":
description: OK
components:
schemas:
CloudEvent:
type: object
properties:
specVersion:
$ref: '#/components/schemas/SpecVersion'
id:
type: string
type:
type: string
source:
format: uri
type: string
dataContentType:
type: string
dataSchema:
format: uri
type: string
subject:
type: string
time:
format: date-time
type: string
attributeNames:
uniqueItems: true
type: array
items:
type: string
extensionNames:
uniqueItems: true
type: array
items:
type: string
data:
$ref: '#/components/schemas/CloudEventData'
CloudEventData:
type: object
EntityTag:
type: object
properties:
value:
type: string
weak:
type: boolean
Family:
enum:
- INFORMATIONAL
- SUCCESSFUL
- REDIRECTION
- CLIENT_ERROR
- SERVER_ERROR
- OTHER
type: string
Link:
type: object
properties:
uri:
format: uri
type: string
uriBuilder:
$ref: '#/components/schemas/UriBuilder'
rel:
type: string
rels:
type: array
items:
type: string
title:
type: string
type:
type: string
params:
type: object
additionalProperties:
type: string
Locale:
type: object
properties:
language:
type: string
script:
type: string
country:
type: string
variant:
type: string
extensionKeys:
uniqueItems: true
type: array
items:
format: byte
type: string
unicodeLocaleAttributes:
uniqueItems: true
type: array
items:
type: string
unicodeLocaleKeys:
uniqueItems: true
type: array
items:
type: string
iSO3Language:
type: string
iSO3Country:
type: string
displayLanguage:
type: string
displayScript:
type: string
displayCountry:
type: string
displayVariant:
type: string
displayName:
type: string
MediaType:
type: object
properties:
type:
type: string
subtype:
type: string
parameters:
type: object
additionalProperties:
type: string
wildcardType:
type: boolean
wildcardSubtype:
type: boolean
MultivaluedMapStringObject:
type: object
additionalProperties:
type: array
items:
type: object
MultivaluedMapStringString:
type: object
additionalProperties:
type: array
items:
type: string
NewCookie:
type: object
properties:
name:
type: string
value:
type: string
version:
format: int32
type: integer
path:
type: string
domain:
type: string
comment:
type: string
maxAge:
format: int32
type: integer
expiry:
format: date
type: string
secure:
type: boolean
httpOnly:
type: boolean
Response:
type: object
properties:
status:
format: int32
type: integer
statusInfo:
$ref: '#/components/schemas/StatusType'
entity:
type: object
mediaType:
$ref: '#/components/schemas/MediaType'
language:
$ref: '#/components/schemas/Locale'
length:
format: int32
type: integer
allowedMethods:
uniqueItems: true
type: array
items:
type: string
cookies:
type: object
additionalProperties:
$ref: '#/components/schemas/NewCookie'
entityTag:
$ref: '#/components/schemas/EntityTag'
date:
format: date
type: string
lastModified:
format: date
type: string
location:
format: uri
type: string
links:
uniqueItems: true
type: array
items:
$ref: '#/components/schemas/Link'
metadata:
$ref: '#/components/schemas/MultivaluedMapStringObject'
headers:
$ref: '#/components/schemas/MultivaluedMapStringObject'
stringHeaders:
$ref: '#/components/schemas/MultivaluedMapStringString'
SpecVersion:
enum:
- V03
- V1
type: string
StatusType:
type: object
properties:
statusCode:
format: int32
type: integer
family:
$ref: '#/components/schemas/Family'
reasonPhrase:
type: string
UriBuilder:
type: object
Loading

0 comments on commit 6a4c99f

Please sign in to comment.