graphql-engine/server/tests-py/queries/openapi/openapi_multiple_endpoints_same_path.yaml
Brandon Simmons 6e8da71ece server: migrate to aeson-2 in preparation for ghc 9.2 upgrade
(Work here originally done by awjchen, rebased and fixed up for merge by
jberryman)

This is part of a merge train towards GHC 9.2 compatibility. The main
issue is the use of the new abstract `KeyMap` in 2.0. See:
https://hackage.haskell.org/package/aeson-2.0.3.0/changelog

Alex's original work is here:
#4305

BEHAVIOR CHANGE NOTE: This change causes a different arbitrary ordering
of serialized Json, for example during metadata export. CLI users care
about this in particular, and so we need to call it out as a _behavior
change_ as we did in v2.5.0. The good news though is that after this
change ordering should be more stable (alphabetical key order).

See: https://hasurahq.slack.com/archives/C01M20G1YRW/p1654012632634389

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4611
Co-authored-by: awjchen <13142944+awjchen@users.noreply.github.com>
GitOrigin-RevId: 700265162c782739b2bb88300ee3cda3819b2e87
2022-06-08 15:32:27 +00:00

180 lines
5.6 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:
description: This OpenAPI specification is automatically generated by Hasura.
title: Rest Endpoints
version: ''
paths:
/api/rest/my_endpoint_url:
get:
summary: with_default_arg
description: "***\nThe GraphQl query for this endpoint is:\n``` graphql\n\
query ($first_name:String=\"Foo\") { test_table(where: {first_name: {\
\ _eq: $first_name } }) { first_name last_name } }\n```"
parameters:
- description: Your x-hasura-admin-secret will be used for authentication
of the API request.
in: header
name: x-hasura-admin-secret
schema:
type: string
- in: query
name: first_name
schema:
default: Foo
type: string
requestBody:
content:
application/json:
schema:
properties:
first_name:
default: Foo
nullable: true
type: string
type: object
description: Query parameters can also be provided in the request body
as a JSON object
required: false
responses:
'200':
content:
application/json:
schema:
properties:
test_table:
items:
properties:
first_name:
title: String
type: string
last_name:
title: String
type: string
type: object
nullable: false
type: array
description: Responses for GET /api/rest/my_endpoint_url
post:
summary: mutation_with_args
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:
- description: Your x-hasura-admin-secret will be used for authentication
of the API request.
in: header
name: x-hasura-admin-secret
schema:
type: string
- description: _"last_name" is required (enter it either in parameters or
request body)_
in: query
name: last_name
schema:
type: string
- description: _"first_name" is required (enter it either in parameters
or request body)_
in: query
name: first_name
schema:
type: string
requestBody:
content:
application/json:
schema:
properties:
first_name:
nullable: false
type: string
last_name:
nullable: false
type: string
type: object
description: Query parameters can also be provided in the request body
as a JSON object
required: false
responses:
'200':
content:
application/json:
schema:
properties:
insert_test_table:
properties:
affected_rows:
title: Int
type: integer
returning:
items:
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: object
nullable: false
type: array
type: object
description: Responses for POST /api/rest/my_endpoint_url
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