Sage-Bionetworks / research-benchmarking-technology

Main repository of the Research & Benchmarking Technology Team
Apache License 2.0
1 stars 1 forks source link

Create python-flask openapi generator template so that controllers aren't overwritten #6

Closed thomasyu888 closed 3 years ago

thomasyu888 commented 3 years ago

Currently, there is quite a bit of work in having to undo the changes that the openapi-generator does, but if we created our own templates to import from a core module within the package that is unchanged, then it wouldn't be an issue.

Essentially this is the command I run to generate a service:

openapi-generator generate -i openapi.yaml -g python-flask -o server -t .codegen/server/

To get to this point, you will want to:

  1. Create your own templates
    openapi-generator author template -g python-flask -o .codegen/server
  2. Edit the templates in these two places:
  3. Create core module by copying everything in controllers in your packages into core. example
  4. Run the generation command above and get something like this: example. Notice how everything in controllers now just pulls from core.controllers.queue_controller?
tschaffter commented 3 years ago

We should create a GH repository where can be develop these template and either publish our custom openapi-generator to npmjs and/or Docker Hub (see openapi-generator Dockerfile).

tschaffter commented 3 years ago

See https://github.com/nlpsandbox/date-annotator-example/pull/96#issuecomment-802553660