Closed sevaru closed 3 years ago
4) In/Out in models, do not generate interfaces for identities? 5) Sample Dotnet + Swagger project
1) Abstract render? 2) Support migration from swagger to swagger?
Endpoint - concrete url
Model - enum(s), DTO(s)
EndpointsConfig - typescript file to select endpoints for generation
// hides work with swagger.json // ~ api getEndpoints getModels getModelByName getEndpointByName getEndpointModels
IModelMetadata IEndpointMetadata
// works with SwaggerService to get some dependencies (e.g. get all models (fields) by model) TODO: proper name, api getModelsByEndpoints
dependency: SwaggerService generate(models: IModel[])
dependency: SwaggerService generate(endpoints: IEndpoints[])
dependency: SwaggerService
const endpointsConfigRenderService = new EndpointsConfigRenderService({ swaggerService, }); /* swaggerService.getEndpoints() */ endpointsConfigRenderService.render();
const endpointsRenderService = new EndpointsRenderService({ swaggerService, }); if (options.all) { endpointsRenderService.renderAll(); } else { const endpointsList = endpointsConfigReader.getEndpoints(); endpointsRenderService.render(endpointsList); }
const modelRenderService = new ModelRenderService({ swaggerService }); // TODO: proper name of service? const models = glueService.getModelsByEndPoints(endpoints); modelRenderService.generate(models);
TODO
1) Start use swaggerService to properly define API 2) Definite swaggerService contracts 3) https://github.com/Luxoft/gengen/issues/20
4) In/Out in models, do not generate interfaces for identities? 5) Sample Dotnet + Swagger project
Questions
1) Abstract render? 2) Support migration from swagger to swagger?
Terminology
Endpoint - concrete url
Model - enum(s), DTO(s)
EndpointsConfig - typescript file to select endpoints for generation
Сервисы
SwaggerService
// hides work with swagger.json // ~ api getEndpoints getModels getModelByName getEndpointByName getEndpointModels
IModelMetadata IEndpointMetadata
GlueService
// works with SwaggerService to get some dependencies (e.g. get all models (fields) by model) TODO: proper name, api getModelsByEndpoints
ModelRenderService // could different implementation for angular, vue, react
dependency: SwaggerService generate(models: IModel[])
EndpointsRenderService // could different implementation for angular, vue, react
dependency: SwaggerService generate(endpoints: IEndpoints[])
EndpointsConfigRenderService
dependency: SwaggerService
ModelsConfigRenderService // maybe to generate only models
dependency: SwaggerService
EndpointsConfigReader // gets method list from endpoints.config.ts
API USAGES
generate facade
generate endpoints (all, by facadeConfig)
generate models