mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-25 00:13:11 +03:00
0c1016e065
Previously invalid REST endpoints would throw errors during schema cache build. This PR changes the validation to instead add to the inconsistent metadata objects in order to allow use of `allow_inconsistent_metadata` with inconsistent REST endpoints. All non-fatal endpoint definition errors are returned as inconsistent metadata warnings/errors depending on the use of `allow_inconsistent_metadata`. The endpoints with issues are then created and return informational runtime errors when they are called. Console impact when creating endpoints is that error messages now refer to metadata inconsistencies rather than REST feature at the top level: ![image](https://user-images.githubusercontent.com/92299/109911843-ede9ec00-7cfe-11eb-9c55-7cf924d662a6.png) <img width="969" alt="image" src="https://user-images.githubusercontent.com/92299/110258597-8336fa00-7ff7-11eb-872c-bfca945aa0e8.png"> Note: Conflicting endpoints generate one error per conflicting set of endpoints due to the implementation of `groupInconsistentMetadataById` and `imObjectIds`. This is done to ensure that error messages are terse, but may pose errors if there are some assumptions made surrounding `imObjectIds`. Related to https://github.com/hasura/graphql-engine-mono/pull/473 (Allow Inconsistent Metadata (v2) #473 (Merged)) --- ### Kodiak commit message Changes the validation to use inconsistent metadata objects for REST endpoint issues. #### Commit title Inconsistent metadata for REST endpoints GitOrigin-RevId: b9de971208e9bb0a319c57df8dace44cb115ff66
62 lines
1.5 KiB
YAML
62 lines
1.5 KiB
YAML
description: Add a conflicting endpoint
|
|
url: /v1/query
|
|
status: 400
|
|
response:
|
|
internal:
|
|
- reason: 'Ambiguous URL paths: :conflicting, simple, simple_cached, with_arg, with_args'
|
|
conflicts:
|
|
- definition:
|
|
query: query { test_table { first_name last_name } }
|
|
url: :conflicting
|
|
methods:
|
|
- GET
|
|
name: conflicting
|
|
comment:
|
|
- definition:
|
|
query: query { test_table { first_name last_name } }
|
|
url: simple
|
|
methods:
|
|
- GET
|
|
name: simple
|
|
comment:
|
|
- definition:
|
|
query: 'query @cached(ttl: 5) { test_table { first_name last_name } }'
|
|
url: simple_cached
|
|
methods:
|
|
- GET
|
|
name: simple_cached
|
|
comment:
|
|
- definition:
|
|
query: 'query ($first_name:String!) { test_table(where: {first_name: { _eq:
|
|
$first_name } }) { first_name last_name } }'
|
|
url: with_arg
|
|
methods:
|
|
- GET
|
|
- POST
|
|
name: with_arg
|
|
comment:
|
|
- definition:
|
|
query: 'query ($first_name: String!, $last_name:String!) { test_table(where:
|
|
{first_name: { _eq: $first_name } last_name: { _eq: $last_name }}) { first_name
|
|
last_name } }'
|
|
url: with_args
|
|
methods:
|
|
- GET
|
|
name: with_args
|
|
comment:
|
|
path: $.args
|
|
error: cannot continue due to new inconsistent metadata
|
|
code: unexpected
|
|
query:
|
|
type: create_rest_endpoint
|
|
args:
|
|
url: ":conflicting"
|
|
name: conflicting
|
|
methods:
|
|
- GET
|
|
definition:
|
|
query:
|
|
collection_name: test_collection
|
|
query_name: simple_query
|
|
|