Describe the bug
Response models generated from inlined arrays are named by the SwaggerModelsGenerator with getClassesFromResponses() by stripping "/" from the path.
if (itemsSchema?.properties.isNotEmpty == true) {
final pathText = key.split('/').map((e) => e.pascalCase).join();
final requestText = operation.pascalCase;
results['$pathText$requestText\$Response'] = neededSchema!;
}
Parameters and rules like cut_from_model_names are not handled. This can lead to the following invalid typedef:
Describe the bug Response models generated from inlined arrays are named by the SwaggerModelsGenerator with getClassesFromResponses() by stripping "/" from the path.
Parameters and rules like cut_from_model_names are not handled. This can lead to the following invalid typedef:
The inlined object within the array is generated correctly as $Item.
To Reproduce
Example with inlined response array
Generated model code with invalid typedef and valid object:
Generated code in *.swagger.chopper.dart:
Generated code in *.swagger.dart:
Expected behavior Typedef of inlined array of objects should be generated with getValidatedClassName()
Changing pathText above results in the following valid output and a successful build:
Swagger specification link Full spec : https://s3.eu-central-1.amazonaws.com/api.loriot.io/index.html?url=https://s3.eu-central-1.amazonaws.com/api.loriot.io/apidoc/documents_v8.1/nwk/nwk-custom.yaml
Simplified (working) example with inlined array (see GET /1/nwk/gateway/{GWEUI}/spectral-scan/{EXECID} ): nwk-custom.yaml.txt
Library version used:
Additional context
Build.yaml