Description
Description
Trying to generate classes for the Magento 2 schema JSON (which has other issues that need addressing within the schema itself), the versioning that Magento has applied to their API gets removed. I wonder if this should be supported in swagger-codegen
?
For example: catalogAttributeSetRepositoryV1
gets converted to an API class of : CatalogAttributeSetRepositoryVApi
. The classname CatalogAttributeSetRepositoryV1Api
would be legal in PHP (just not if the first character of the class was a number).
Swagger-codegen version
2.2.2-SNAPSHOT
Swagger declaration file content or url
http://devdocs.magento.com/swagger/schemas/latest-2.0.schema.json
{
"tags": [
{
"name": "storeStoreRepositoryV1",
"description": "Store repository interface"
},
]
}
Command line used for generation
Using jimschubert/swagger-codegen-cli:
docker-compose.yml
:
swagger:
image: jimschubert/swagger-codegen-cli
volumes:
- ./swagger/config:/root/config
- ./swagger/schema:/root/schema
- ./swagger/export:/root/export
config.json
:
{
"variableNamingConvention" : "camelCase",
"invokerPackage" : "SwaggerClient\\MagentoEnterprise212",
"packagePath" : "MagentoEnterprise212",
"composerProjectName" : "swaggerclient-magentoenterprise212",
"gitUserId" : "test"
}
Command:
docker-compose run --rm swagger generate \
-i /root/schema/magento2/schema.json \
-l php \
-o /root/export/result/ \
-c /root/config/magento2/config.json
Steps to reproduce
- Create docker-compose file with service shown above, with host sub-directories shown (
./swagger/config
,./swagger/schema
,./swagger/export
) - Download Magento 2 schema to
./swagger/schema/schema.json
- Create
config.json
in./swagger/config/config.json
with contents shown above - Run above command
Related issues
#2392 - [PHP] Invalid classes generated if models start with a digit.
Magento 2 - PR 7446 - addressing issue with schema generation.