graphql-engine/server/tests-py/queries/openapi/openapi_multiple_endpoints_same_path.yaml
David Overton 63291f6de8 fix OpenAPI for mutiple methods on same REST endpoint path
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2603
GitOrigin-RevId: 32b3133f0bb1a9bf50e4db492bab1eabf5a9430c
2021-10-14 10:32:18 +00:00

127 lines
3.1 KiB
YAML

- description: Try to add a GET rest endpoint with default argument
url: /v1/query
status: 200
response:
message: success
query:
type: create_rest_endpoint
args:
url: my_endpoint_url
name: with_default_arg
methods:
- GET
definition:
query:
collection_name: test_collection
query_name: query_with_default_arg
- description: Try to add a POST rest mutation endpoint using same URL path
url: /v1/query
status: 200
response:
message: success
query:
type: create_rest_endpoint
args:
url: my_endpoint_url
name: mutation_with_args
methods:
- POST
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: These OpenAPI specifications are automatically generated by Hasura.
paths:
/api/rest/my_endpoint_url:
get:
summary: with_default_arg
description: >-
***
The GraphQl query for this endpoint is:
``` graphql
query ($first_name:String="Foo") { test_table(where: {first_name: { _eq:
$first_name } }) { first_name last_name } }
```
responses: {}
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:
default: Foo
type: string
in: query
name: first_name
post:
summary: mutation_with_args
description: >-
***
The GraphQl query for this endpoint is:
``` graphql
mutation ($first_name: String!, $last_name: String!) {
insert_test_table( objects: {first_name: $first_name, last_name:
$last_name }) { returning { id } affected_rows } }
```
responses: {}
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
- schema:
type: string
in: query
name: last_name
components: {}
- description: Try to remove the endpoint
url: /v1/query
status: 200
response:
message: success
query:
type: drop_rest_endpoint
args:
name: with_default_arg
- description: Try to remove the endpoint
url: /v1/query
status: 200
response:
message: success
query:
type: drop_rest_endpoint
args:
name: mutation_with_args