Broken OpenAPI Spec

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"
      },
1 Like

Can the HF version their openAPI spec file? Currently, there is only one URL ( https://api.endpoints.huggingface.cloud/openapi.json). When this breaks, it breaks everything that uses this openAPI generator, including in prod.

This is a huge downstream affect that causes whole builds to fail.

1 Like

I reported it to HF Discord for now.

1 Like