yeti-platform / yeti

Your Everyday Threat Intelligence
https://yeti-platform.io/
Apache License 2.0
1.76k stars 291 forks source link

Swagger OpenAPI 3.0 not supported #1160

Open udgover opened 1 month ago

udgover commented 1 month ago

Description

OpenAPI specs served by FastAPI is not handled by Swagger 3.0 used to generate client in targeted language.

Steps to Reproduce

Download http://yeti_host/openapi.json and load it in Swagger online editor. Notice the different errors after loading.

Identified errors

OpenAPI version:

Structural error at openapi
should match pattern "^3\.0\.\d(-.+)?$"
pattern: ^3\.0\.\d(-.+)?$
Jump to line 1

additionalProperty: const

Structural error at components.schemas.Certificate-Output.properties.type
should NOT have additional properties
additionalProperty: const
Jump to line 3340

const property is part of OpenAPI 3.1 specification.

Invalid type value:

Structural error at paths./api/v2/tasks/{task_name}/run.post.requestBody.content.application/json.schema.anyOf.1.type
should be equal to one of the allowed values
allowedValues: array, boolean, integer, number, object, string
Jump to line 1595

type: 'null' is supported part of OpenAPI 3.1.

additionalProperty: prefixItems

Structural error at components.schemas.IndicatorSearchRequest.properties.sorting.items
should NOT have additional properties
additionalProperty: prefixItems
Jump to line 6282

prefixItems property is part of OpenAPI >=3.1 specification

Fix

We must mention in the documentation that OpenAPI versions prior to 3.1 are not supported.