graphql-engine/server/tests-py/queries/openapi/openapi_endpoint_with_multiple_methods.yaml
Antoine Leblanc 74513e351f Use an enum for EndpointMethod and fix incorrect response aggregation.
### Description

This small PR improves the representation of an endpoint method from `Text` to an enum of the supported methods. Additionally, it cleans some of the instances defined on surrounding types (such as Postgres-specific instances on Endpoint types).

Due to a name conflict, this makes `RQL.Types.Endpoint` impossible to re-export from `RQL.Types`, which in turn forces several other modules to import it explicitly, which I think is fine since we want to ultimately get rid of `RQL.Types`.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3965
GitOrigin-RevId: 33869007d0d818ddf486fb61d1f6099f9dad7570
2022-03-13 07:41:02 +00:00

351 lines
13 KiB
YAML

- description: Try to add a rest endpoint with multiple methods
url: /v1/query
status: 200
response:
message: success
query:
type: create_rest_endpoint
args:
url: multi_method_endpoint
name: multi_method_endpoint
methods:
- GET
- POST
- PUT
- DELETE
- PATCH
definition:
query:
collection_name: test_collection
query_name: mutation_with_args
- description: Call openapi json endpoint
url: /api/swagger/json
method: GET
status: 200
query:
response:
openapi: 3.0.0
info:
version: ''
title: Rest Endpoints
description: This OpenAPI specification is automatically generated by Hasura.
paths:
/api/rest/multi_method_endpoint:
get:
summary: multi_method_endpoint
description: "***\nThe GraphQl query for this endpoint is:\n``` graphql\n\
mutation ($first_name: String!, $last_name: String!) { insert_test_table(\
\ objects: {first_name: $first_name, last_name: $last_name }) { returning\
\ { id } affected_rows } }\n```"
parameters:
- schema:
type: string
in: header
name: x-hasura-admin-secret
description: Your x-hasura-admin-secret will be used for authentication
of the API request.
- schema:
type: string
in: query
name: first_name
description: _"first_name" is required (enter it either in parameters or request body)_
- schema:
type: string
in: query
name: last_name
description: _"last_name" is required (enter it either in parameters or request body)_
requestBody:
required: false
content:
application/json:
schema:
type: object
properties:
first_name:
type: string
nullable: false
last_name:
type: string
nullable: false
description: Query parameters can also be provided in the request body
as a JSON object
responses:
'200':
content:
application/json:
schema:
properties:
insert_test_table:
type: object
properties:
returning:
items:
type: object
properties:
id:
pattern: '[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}'
title: uuid
type: string
type: array
nullable: false
affected_rows:
title: Int
type: integer
description: Responses for GET /api/rest/multi_method_endpoint
put:
summary: multi_method_endpoint
description: "***\nThe GraphQl query for this endpoint is:\n``` graphql\n\
mutation ($first_name: String!, $last_name: String!) { insert_test_table(\
\ objects: {first_name: $first_name, last_name: $last_name }) { returning\
\ { id } affected_rows } }\n```"
parameters:
- schema:
type: string
in: header
name: x-hasura-admin-secret
description: Your x-hasura-admin-secret will be used for authentication
of the API request.
- schema:
type: string
in: query
name: first_name
description: _"first_name" is required (enter it either in parameters or request body)_
- schema:
type: string
in: query
name: last_name
description: _"last_name" is required (enter it either in parameters or request body)_
requestBody:
required: false
content:
application/json:
schema:
type: object
properties:
first_name:
type: string
nullable: false
last_name:
type: string
nullable: false
description: Query parameters can also be provided in the request body
as a JSON object
responses:
'200':
content:
application/json:
schema:
properties:
insert_test_table:
type: object
properties:
returning:
items:
type: object
properties:
id:
pattern: '[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}'
title: uuid
type: string
type: array
nullable: false
affected_rows:
title: Int
type: integer
description: Responses for PUT /api/rest/multi_method_endpoint
post:
summary: multi_method_endpoint
description: "***\nThe GraphQl query for this endpoint is:\n``` graphql\n\
mutation ($first_name: String!, $last_name: String!) { insert_test_table(\
\ objects: {first_name: $first_name, last_name: $last_name }) { returning\
\ { id } affected_rows } }\n```"
parameters:
- schema:
type: string
in: header
name: x-hasura-admin-secret
description: Your x-hasura-admin-secret will be used for authentication
of the API request.
- schema:
type: string
in: query
name: first_name
description: _"first_name" is required (enter it either in parameters or request body)_
- schema:
type: string
in: query
name: last_name
description: _"last_name" is required (enter it either in parameters or request body)_
requestBody:
required: false
content:
application/json:
schema:
type: object
properties:
first_name:
type: string
nullable: false
last_name:
type: string
nullable: false
description: Query parameters can also be provided in the request body
as a JSON object
responses:
'200':
content:
application/json:
schema:
properties:
insert_test_table:
type: object
properties:
returning:
items:
type: object
properties:
id:
pattern: '[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}'
title: uuid
type: string
type: array
nullable: false
affected_rows:
title: Int
type: integer
description: Responses for POST /api/rest/multi_method_endpoint
delete:
summary: multi_method_endpoint
description: "***\nThe GraphQl query for this endpoint is:\n``` graphql\n\
mutation ($first_name: String!, $last_name: String!) { insert_test_table(\
\ objects: {first_name: $first_name, last_name: $last_name }) { returning\
\ { id } affected_rows } }\n```"
parameters:
- schema:
type: string
in: header
name: x-hasura-admin-secret
description: Your x-hasura-admin-secret will be used for authentication
of the API request.
- schema:
type: string
in: query
name: first_name
description: _"first_name" is required (enter it either in parameters or request body)_
- schema:
type: string
in: query
name: last_name
description: _"last_name" is required (enter it either in parameters or request body)_
requestBody:
required: false
content:
application/json:
schema:
type: object
properties:
first_name:
type: string
nullable: false
last_name:
type: string
nullable: false
description: Query parameters can also be provided in the request body
as a JSON object
responses:
'200':
content:
application/json:
schema:
properties:
insert_test_table:
type: object
properties:
returning:
items:
type: object
properties:
id:
pattern: '[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}'
title: uuid
type: string
type: array
nullable: false
affected_rows:
title: Int
type: integer
description: Responses for DELETE /api/rest/multi_method_endpoint
patch:
summary: multi_method_endpoint
description: "***\nThe GraphQl query for this endpoint is:\n``` graphql\n\
mutation ($first_name: String!, $last_name: String!) { insert_test_table(\
\ objects: {first_name: $first_name, last_name: $last_name }) { returning\
\ { id } affected_rows } }\n```"
parameters:
- schema:
type: string
in: header
name: x-hasura-admin-secret
description: Your x-hasura-admin-secret will be used for authentication
of the API request.
- schema:
type: string
in: query
name: first_name
description: _"first_name" is required (enter it either in parameters or request body)_
- schema:
type: string
in: query
name: last_name
description: _"last_name" is required (enter it either in parameters or request body)_
requestBody:
required: false
content:
application/json:
schema:
type: object
properties:
first_name:
type: string
nullable: false
last_name:
type: string
nullable: false
description: Query parameters can also be provided in the request body
as a JSON object
responses:
'200':
content:
application/json:
schema:
properties:
insert_test_table:
type: object
properties:
returning:
items:
type: object
properties:
id:
pattern: '[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}'
title: uuid
type: string
type: array
nullable: false
affected_rows:
title: Int
type: integer
description: Responses for PATCH /api/rest/multi_method_endpoint
components: {}
- description: Try to remove the endpoint
url: /v1/query
status: 200
response:
message: success
query:
type: drop_rest_endpoint
args:
name: multi_method_endpoint