OpenAPITools / OpenAPITools/openapi-generator
[php] Question on schema->class Name
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Hi there,
My OpenAPI schema looks like this:
...
"200": {
"description": "successful operation",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/_default"
}
}
}
},
....
"components": {
"schemas": {
"_default": {
"type": "object",
"title": "DefaultResponse",
"properties": {
"msg": {
"type": "string",
"description": "Message to return on routes, without response data",
"example": "done"
}
}
},
...
Which results in invalid PHP Code:
class Default implements ModelInterface, ArrayAccess, \JsonSerializable
{
....
protected static $openAPIModelName = '_default';
...
Of course "default" is reserved in PHP, but my actual Schema is not called "default".
Is there a way to use the title "DefaultResponse" as Class-Name?
Thanks a lot!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the generated PHP model from the OpenAPI schema shown in the issue, focusing on the interaction between the _default schema name and its DefaultResponse title. Inspect the PHP generator's model naming behavior and determine a valid class-name outcome; done means the generated PHP is valid and the schema title is used when appropriate.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi, php
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100