Skip to content

OpenAPI spec: Invalid "unknown_type" and duplicate field in Part schema break generated Rust client #1414

@Flo2410

Description

@Flo2410

Describe the bug
Two bugs in the OpenAPI spec at /api/docs.json cause a generated Rust client to fail compilation.
This is caused by two independent errors in the spec.
I only made one issue, as both individually make the build fail. If I should split it into two, please let me know.

  1. groupedParameters uses "type": "unknown_type" on several schemas. This is not a valid OpenAPI type per the OAS 3.1 spec.
  2. The Part schema defines manufacturer_product_url and manufacturerProductURL as separate properties. Both map to the same identifier in any generator that normalises casing.

To Reproduce
Steps to reproduce the behavior:

curl -H "Authorization: Bearer <token>" https://<your-partdb>/api/docs.json -o spec.json
openapi-generator-cli generate -i spec.json -g rust -o ./partdb-rs --skip-validate-spec
cd partdb-rs && cargo build

You will get these two erros:

error[E0425]: cannot find type `UnknownType` in module `models`
error[E0124]: field `manufacturer_product_url` is already declared

Expected behavior

  1. Replace "type": "unknown_type" with an empty schema {}. Per JSON Schema 2020-12
    §4.3.2
    , {} accepts any value.
  2. Remove manufacturerProductURL or manufacturer_product_url one is enough to cover that field.

Screenshots
N/A

Server Side

  • Part-DB Version: Part-DB 2.12.1
  • PHP Version: PHP 8.4.22
  • Database Server: MySQL 8.0.46

Desktop (please complete the following information):
N/A

Smartphone (please complete the following information):
N/A

Additional context
While the Rust generator is used as the example here, both bugs will affect any generator that validates type names or normalises property names to a single casing convention.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions