From ef7c6cb43aa8cc8c38a4e51d4d7e78b66e08a5c1 Mon Sep 17 00:00:00 2001 From: JD Davis Date: Thu, 13 Jun 2024 23:25:47 -0500 Subject: [PATCH] chore: added spectral to lint OpenAPI spec --- .github/workflows/test.yaml | 10 ++++++++++ .spectral.yaml | 1 + specs/openapi-3.1.yaml | 9 ++++----- 3 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 .spectral.yaml diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index dbb6c2fd..9745f266 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -231,6 +231,16 @@ jobs: OLLAMA_SKIP_CPU_GENERATE: '1' # TODO - do we need any artifacts? + validate-openapi: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + - uses: stoplightio/spectral-action@latest + with: + file_glob: 'specs/*.yaml' + lint: strategy: matrix: diff --git a/.spectral.yaml b/.spectral.yaml new file mode 100644 index 00000000..1cac3b3d --- /dev/null +++ b/.spectral.yaml @@ -0,0 +1 @@ +extends: ["spectral:oas", "spectral:asyncapi"] diff --git a/specs/openapi-3.1.yaml b/specs/openapi-3.1.yaml index 93c2753c..b601c51e 100644 --- a/specs/openapi-3.1.yaml +++ b/specs/openapi-3.1.yaml @@ -3,6 +3,9 @@ info: title: Ollama API description: API for interacting with the Ollama service. version: 0.1.44 + contact: + name: Ollama + url: https://github.com/ollama/ollama servers: - url: http://{host}:{port} description: Ollama API server @@ -337,22 +340,18 @@ components: items: type: string format: byte - description: A list of base64-encoded images (for multimodal models such as llava) - example: null + description: A list of base64-encoded images (for multimodal models such as llava) format: type: string description: The format to return a response in. Currently the only accepted value is json - example: null options: $ref: '#/components/schemas/Options' system: type: string description: System message to (overrides what is defined in the Modelfile) - example: null template: type: string description: The prompt template to use (overrides what is defined in the Modelfile) - example: null context: type: array items: