Luxoft / gengen

Tool for generating models and Angular services based on OpenAPIs and Swagger's JSON.
MIT License
17 stars 8 forks source link

GenGen ~ Roadmap #21

Closed sevaru closed 3 years ago

sevaru commented 3 years ago

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

const endpointsConfigRenderService = new EndpointsConfigRenderService({
  swaggerService,
});
/*
swaggerService.getEndpoints()
*/
endpointsConfigRenderService.render();

generate endpoints (all, by facadeConfig)

const endpointsRenderService = new EndpointsRenderService({
  swaggerService,
});

if (options.all) {
  endpointsRenderService.renderAll();
} else {
  const endpointsList = endpointsConfigReader.getEndpoints();
  endpointsRenderService.render(endpointsList);
}

generate models

const modelRenderService = new ModelRenderService({ swaggerService });

// TODO: proper name of service?
const models = glueService.getModelsByEndPoints(endpoints); 

modelRenderService.generate(models);