Open glenncoppens opened 5 months ago
Hi @glenncoppens, can you please share the command you used so I can try to reproduce it?
OAS3.1 should be supported out of the box so it could be something with the spec, I pasted it in https://editor.swagger.io/ and it shows some similar warnings...
Additionally, maybe you have a YAML version to test?
@vsouz4 Yes indeed, you're right! Unfortunately I don't have a yml file available though.
Command i used:
OPENAPI=data/uitdatabank-entry-api.json NAMESPACE=UitDatabank\Api PACKAGE=uitdatabank/api OUTPUT_DIR=dist/src php ./bin/api-client-generator generate
I've tried using de 'official' php-generator from the openapi-generator cli (didn't know that one before yours, it's java based) and it resulted in the same errors. Although they have an option to ignore validation errors, which made it work in the end but then again, not sure if it has a negative impact on the resulting php source code.
On the other hand they don't fully support php8 (yet) for the generated client as per my understanding.
So I'm quite stuck on how to proceed 😅
thx for the command, I ran it here and did some debugging, ik what the issue is 😄 please bear with me:
I'll open an issue here in github for this operationId handling to be fixed, and we can keep your issue opened to add proper support for OAS 3.1, but I hope with these 2 changes you can generate your client in the meantime
@vsouz4
Oh thanks!
But I see I pasted the wrong OpenAPI file, it should have been this one: https://stoplight.io/api/v1/projects/publiq/uitdatabank/nodes/reference/entry.json?deref=optimizedBundle
But as per your suggestion I've managed to remove those errors you mentioned.
There's only one error left:
"Reference: additional properties are given
. Only $ref should be set in a Reference Object.","Invalid key 'Event-@id' used in Co
mponents Object for attribute 'schemas', does not match ^[a-zA-Z0-9\\.\\-_]+$.","Inva
lid key 'Organizer-@id' used in Components Object for attribute 'schemas', does not m
atch ^[a-zA-Z0-9\\.\\-_]+$.","Invalid key 'Place-@id' used in Components Object for a
ttribute 'schemas', does not match ^[a-zA-Z0-9\\.\\-_]+$.",
... omitted
But I'm guessing it's related by having a dash in the key?
I've attached a version of the OpenApi file with already renamed "operationId" keys. entry-api-3.json
Is it possible to rename those key references with a "-@" to achieve an OAS3.0 compatible version?
I'm able to generate a client if:
:%s/\([^"]*\)".*,\n\s*"\($ref.*\)/\1"\2/
:%s/\($ref": .*\),\n\s*"description.*/\1/
:%s/-@/-
but FYI the generated code will completely ignore the "if" / "then" and "dependentRequired" from json schema / oas 3.1 (and any other props I might've missed)
last but not least, we currently don't support type: oauth2 in security still, so this is also being ignored atm, any help is very much appreciated to add support for that
Hi,
I tried to generate an api client based on a json openapi v3.1.0 (https://docs.publiq.be/docs/uitdatabank/taxonomy-api%2Fopenapi-file), but validation fails as OAS3.1 seems to be not (yet) supported.
I've listed some of the validation exceptions:
"Unsupported openapi version: 3.1.0"
"Reference: additional properties are given. Only $ref should be set in a Reference Object."
"Invalid key 'Event-@id' used in Components Object for attribute 'schemas', does not match ^[a-zA-Z0-9\\.\\-_]+$."
"Invalid key 'Organizer-@id' used in Components Object for attribute 'schemas', does not match ^[a-zA-Z0-9\\.\\-_]+$."
What could/should be done to provide support for OAS 3.1? I'm not familiar with the inner workings and detailed OAS specs, but open to collaborate.
PS: tried to downgrade the json from 3.1 to 3.0 which, when trying to generate the api client afterwards, only throwed the "Invalid key" exceptions twice.
Thanks,
Glenn