Problem
The latest OpenAPI Spec is invalid causing downstream breaking compilation errors when referencing the spec directly. The following error occurs:
* What went wrong:
Execution failed for task ':ml-app:openApiGenerate'.
> There were issues with the specification. The option can be disabled via validateSpec (Maven/Gradle) or --skip-validate-spec (CLI).
| Error count: 2, Warning count: 13
Errors:
-attribute components.schemas.SeriesHardware.T is not of type `schema`
-attribute components.schemas.MetricsParams.ReplicaId is not of type `schema`
Warnings:
-attribute components.schemas.SeriesHardware.T is not of type `schema`
-attribute components.schemas.MetricsParams.ReplicaId is not of type `schema`
from the following gradle code:
openApiGenerate {
generatorName.set("java")
remoteInputSpec.set("https://api.endpoints.huggingface.cloud/openapi.json")
outputDir.set("${project.buildDir}/generated")
...
Solution
There are two missing schemas: ReplicaId
and T
. I’ve created the following definitions:
"ReplicaId": {
"type": "string",
"description": "A unique identifier for a replica"
}
and
"T": {
"type": "number",
"description": "Generic numeric type used in multiple schemas"
},