Description
Describe the bug
The Open API specification has some duplicate properties.
While trying to build Rust bindings from the Open API spec using https://openapi-generator.tech, I found that some properties are duplicated in the spec. These are defined in camelCase and snake_case. Some even have different descriptions with the same meaning.
The openai rust generator converts camelCase proptery names to snake_case which leads to the definition of multiple fields with the same name.
For example, InfoProviderReference.jsonapi
has the property
"provider_key": {
"readOnly": true,
"description": "The key referencing the provider used to get this part, or null if it was not provided by a data provider",
"type": [
"string",
"null"
]
},
with the duplicate
"providerKey": {
"readOnly": true,
"description": "Returns the key usable to identify the provider, which provided this part. Returns null, if the part was not created by a provider.",
"type": [
"string",
"null"
]
},
In the case of InfoProviderReference.jsonapi
all properties are duplicated, but for other it's just some individual properties.
Here is a hopefully complete list of the duplicates I found:
ApiToken.jsonapi
- valid_until / validUntil
- last_time_used / lastTimeUsed
AttachmentContainingDBElement.jsonapi
- master_picture_attachment / masterPictureAttachment
EDACategoryInfo.jsonapi
- reference_prefix / referencePrefix
- exclude_from_bom / excludeFromBom
- exclude_from_board / excludeFromBoard
- exclude_from_sim / excludeFromSim
- kicad_symbol / kicadSymbol
EDAFootprintInfo.jsonapi
- kicad_footprint / kicadFootprint
EDAPartInfo.jsonapi
- reference_prefix / referencePrefix
- exclude_from_bom / excludeFromBom
- exclude_from_sim / excludeFromSim
- kicad_symbol / kicadSymbol
- kicad_footprint / kicadFootprint
Group.jsonapi
- not_selectable / notSelectable
- alternative_names / alternativeNames
- master_picture_attachment / masterPictureAttachment
InfoProviderReference.jsonapi
- provider_key / providerKey
- provider_id / providerId
- provider_url / providerUrl
- last_updated / lastUpdated
Orderdetail.jsonapi
- supplier_product_url / supplierProductUrl
PartAssociation.jsonapi
- other_type / otherType
PartLot.jsonapi
- expiration_date / expirationDate
- instock_unknown / instockUnknown
- needs_refill / needsRefill
- user_barcode / userBarcode
- storage_location / storageLocation
User.jsonapi
- pw_reset_expires / pwResetExpires
- need_pw_change / needPwChange
- pw_reset_token / pwResetToken
- first_name / firstName
- last_name / lastName
- show_email_on_profile / showEmailOnProfile
- webauthn_keys / webauthnKeys
- saml_user / samlUser
- api_tokens / apiTokens
- master_picture_attachment / masterPictureAttachment
WebauthnKey.jsonapi
- last_time_used / lastTimeUsed
To Reproduce
A: Download the Open API spec from partdb-instance/api/docs.json
and find the duplicate key.
B: Generate the Rust bindings and try to build them
To generate the bindings
openapi-generator-cli generate -i ./partdb-api-docs.json -g rust -o ./partdb-rs -c ./openapi-config.yaml
openapi-config.yaml
additionalProperties:
packageName: partdb-rs
packageVersion: 1.12.0
supportAsync: true
preferUnsignedInt: true
cd
into the partdb-rs
folder and run cargo build
Expected behavior
I would expect that the properties are only defined once, so that tha Open API spec can be used to build Rust bindings.
Server Side
- Part-DB Version: 1.15.2 (docker: jbtronics/part-db1:latest)
- PHP Version: 8.3.16 (SAPI: fpm-fcgi)
- Database Server: MySQL 8.0.41 (docker: mysql:8.0)
Desktop (please complete the following information):
- OS: NixOS 24.11
- Browser: Zen (Firefox)
Activity