Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .github/workflows/open-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,16 @@ jobs:
python-version: 3.9
- name: Install
working-directory: ./open-api
run: pip install openapi-spec-validator==0.5.2
run: make install
- name: Validate REST catalog spec
working-directory: ./open-api
run: openapi-spec-validator rest-catalog-open-api.yaml
run: make lint
- name: Generate REST catalog spec Python code
working-directory: ./open-api
run: make generate
- name: Check if code is up to date
working-directory: ./open-api
run: git diff --exit-code
- name: Validate S3 REST Signer spec
working-directory: ./aws/src/main/resources
run: openapi-spec-validator s3-signer-open-api.yaml
33 changes: 33 additions & 0 deletions open-api/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

install:
pip install -r requirements.txt

lint:
openapi-spec-validator --errors all rest-catalog-open-api.yaml

generate:
datamodel-codegen \
--target-python-version 3.8 \
--use-schema-description \
--field-constraints \
--input rest-catalog-open-api.yaml \
--disable-timestamp \
--custom-file-header-path header.txt \
--input-file-type openapi \
--output rest-catalog-open-api.py
42 changes: 42 additions & 0 deletions open-api/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-->

# Open API spec

The `rest-catalog-open-api.yaml` defines the REST catalog interface.

## Lint

To make sure that the open-api definition is valid, you can run the `lint` command:

```sh
make install
make lint
```

## Generate Python code

When updating `rest-catalog-open-api.yaml`, make sure to update `rest-catalog-open-api.py` with the spec changes by running the following commands:

```sh
make install
make generate
```

The generated code is not being used in the project, but helps to see what the changes in the open-API definition are in the generated code.
16 changes: 16 additions & 0 deletions open-api/header.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
19 changes: 19 additions & 0 deletions open-api/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

openapi-spec-validator==0.5.2
git+https://github.com/koxudaxi/datamodel-code-generator/
Loading