kbendick opened a new pull request #4027:
URL: https://github.com/apache/iceberg/pull/4027


   This and closes https://github.com/apache/iceberg/issues/4026
   
   In some places in the OpenAPI spec for the REST catalog, we're using 
`response` type components where `schema` type components are expected and vice 
versa.
   
   This passes many parsers (we're still on the hunt for a canonical parser), 
but I've been using a NodeJS / NPM module from https://openapi.tools called 
`openapi-spec-validator`. It can be installed, hopefully with an up to date 
nodejs, using `npm install -h openapi-spec-validator`.
   
   The output is kind of cryptic, but once it gets to `OK` then it's `OK`.
   
   This PR fixes any issues from that with the minimal change set possible 
(barring one schema name change to make things a bit more clear).
   
   ## What has changed
   
   1. Renamed `StandardErrorWrapper`, the inner base schema element for 
IcebergErrorResponse, to be `ErrorModel`. I've found examples named similarly 
in the OpenAPI docs, and it seems more clear.
   2. Replaced components that require a component from the "schema" section of 
the doc that were using `IcebergErrorResponse` to use `ErrorModel`, as 
`IcebergErrorResponse` comes from the "request" section of components)
   3. Replaced components that were written out in long form to just have a 
`$ref` when it uses a component from the request component that is clear.
   4. Fixed a small typo
   
   #### Validating via CLI tool
   
   Before this PR - The error output is somewhat cryptic using 
`openapi-spec-validator`, but this is the best tool I've found so far:
   ```bash
   $  openapi-spec-validator  rest_docs/rest-catalog-open-api.yaml
   {'description': 'OK', 'content': {'application/json': {'schema': {'$ref': 
'#/components/responses/CommitTableResponse', 'x-scope': 
['file:///Users/kylebendickson/repos/kbendick-iceberg/rest_docs/rest-catalog-open-api.yaml']}}}}
 is not valid under any of the given schemas
   
   Failed validating 'oneOf' in 
schema['properties']['paths']['patternProperties']['^\\/']['patternProperties']['^(get|put|post|delete|options|head|patch|trace)$']['properties']['responses']['patternProperties']['^[1-5](?:\\d{2}|XX)$']:
       {'oneOf': [{'$ref': '#/definitions/Response'},
                  {'$ref': '#/definitions/Reference'}]}
   
   On 
instance['paths']['/v1/namespaces/{namespace}/tables/{table}']['post']['responses']['200']:
       {'content': {'application/json': {'schema': {'$ref': 
'#/components/responses/CommitTableResponse',
                                                    'x-scope': 
['file:///Users/kylebendickson/repos/kbendick-iceberg/rest_docs/rest-catalog-open-api.yaml']}}},
   ```
   
   After this PR:
   ```bash
   $ openapi-spec-validator  rest_docs/rest-catalog-open-api.yaml
   OK
   ```
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to