menes-dotnet / Menes

OpenAPI and dotnet service abstractions. Sponsored by endjin.
Apache License 2.0
34 stars 2 forks source link

Prototype roundtripping code generator #2

Open mwadams opened 5 years ago

mwadams commented 5 years ago

Problem space

We would like to be able to roundtrip from OpenAPI document to csharp service code and back, in Menes.

Proposal

  1. Build a model of the CSharp solution that extracts the OpenAPI-related service and type defintiions
  2. Identify diffs between the CSharp model and the OpenAPI doc
  3. Apply diffs

Questions for the PoC

  1. Can Roslyn be used to identify the salient information in the solution to generate the OpenApi -> service diffs
  2. Most of the challenges are in identifying the serialization form of the input and output parameters. What can we do without further warts in the OpenAPI doc and/or codebase to help with this? What can we do with additional attribute warts? Are there other approaches that would avoid the warts?
  3. What can we do to allow you to plug in custom generation/description for your models? As we can see the comment trivia, can we use that to help with the round-tripping?
mwadams commented 5 years ago

The initial spike to address some of these questions are in this branch.

The ServiceBuilder prototype is in this folder

A good way in is through this method