Skip to content

[Spike] Strongly typed integration - compile-time check #1070

@dhmlau

Description

@dhmlau

Strongly typed integration - compile-time check

Developer Experience

Take Google mapping API as an example.

  • User wants to talk to Google mapping API, LB asks for swagger file
  • If they provide, LB can do the introspection to generate all the artifacts.
  • If they don't, LB can go with the traditional REST connector approach, asking them to specify the template. The purpose of the template is to describe the REST api.
  • If they want to re-expose the API, then LB can guide them to generate the controller.

What's involved

  • tooling to:
    • introspect the service spec
    • generate the corresponding LB artifacts, e.g. TS interface definition and model definition.
    • create service / service proxy. Similar to LB3 lb soap command

Going back to the Google mapping api, it will end up with google mapping service -> Google Map service interface / class. Then the controller can delegate its calls to its strongly typed methods.

If users want to re-expose the service API, LB needs to have some tooling / convention to help them.

Questions to answer

Spike: handwrite to see how the generated artifacts work together with the controller.
If we can handwrite the generated artifacts, then we can automate it.

  • Starting point: write sample app which has controller that tries to talk to REST / SOAP services.
    Inside the controller, you can import the type information of the service. Make method call which will be translated to the juggler / connector which will invoke the backend services.
  • tooling: if you receive datasource configuration (URL/path to the OpenAPI spec/template for REST API/ URL/path to WSDL for SOAP), then you should have enough info to introspect the service spec, and generate the corresponding LB artifacts.
    • scope of tooling for the spike: wireframe/mockup of how the tooling can look like, i.e. what to prompt users.

Note:

  • task for strongly typed and weakly typed can go in parallel.
  • strongly typed would be a stretch goal of GA
  • cross-posting from Type safety for services #1268
    • Introduce CLI tooling to discover service and introspect the service specifications and generate the corresponding TypeScript artifacts
    • Make this mapping pluggable and extensible to support different api spec flavours (swagger, wsdl, openapi, grpc, graphql, etc)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions