-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Currently, API responses are assumed to be correct but are not instantiated into model classes. This gap leads to type risks and makes it difficult to validate or manage response data effectively. To improve robustness and maintainability, model classes should be created for all API responses, and incoming data should be parsed into these models.
Proposed solution:
- Define model classes for all relevant API responses.
- Implement conversion/parsing logic to instantiate these models from raw API response data.
- Update all code paths that use API responses to utilize these model classes.
- Add unit tests to verify that response data is correctly mapped into the models and that errors are handled gracefully.
Code context:
- The code generation workflow in [
OpenAPIDyalog/Program. cs](https://github.com/Dyalog/OpenAPI/blob/b58f1b4a8e8a3113e11370b0f3977e8ca360e483/OpenAPIDyalog/Program. cs#L116-L160) orchestrates endpoint and model generation but does not currently enforce or utilize API response models after data retrieval. - The service
CodeGeneratorServicegenerates models from schemas (GenerateModelsAsync), and has context and property definitions for models (seeModelTemplateContext), but actual parsing of API responses into these models is not yet implemented. - The model definition infrastructure is present (see
ModelTemplateContext) but should be extended to cover instantiation from runtime response data.
Benefits:
- Improved type safety and code reliability.
- Easier validation and management of API data.
- Better maintainability and extensibility for future API changes.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request