Closed epeters3 closed 1 year ago
I think it would be slicker than a used car salesman if we could do something like this for a Typescript SDK. I imagine over time that we'd use it quite heavily internally. Also, one-schema
already has support for generating Typescript axios clients, so the lift is much smaller than it was here. It would be nice if the SDK was updated automatically though, so you didn't have to touch another repo.
It would be nice if the SDK was updated automatically though, so you didn't have to touch another repo.
I'd say the same thing about the API docs site: it would be nice if it was updated automatically. I haven't thought of the right way to do this yet though. Ideally public API docs and public SDKs should reflect the current state of prod, but I think we'd also want an internal SDK that reflected the current state of dev. Maybe an easy starter way to do it would be to automatically refresh the docs and clients every day using the current state of prod.
It would be nice if the SDK was updated automatically though, so you didn't have to touch another repo.
That would be a nice design goal that both javascript/typescript sdk and python sdk shares the same schema files that could be updated while the ts/js/py codes are generated only
This PR updates the
bin/one-schema.py
script to consume OpenAPI schema files returned byone-schema
. It uses the schema to generate a fully typed API client for the Patient ML service, including support for IDE static type analysis and runtime type checks. Endpoint and field-level doc strings are preserved as well.Right now only Patient ML Service is using this code generation feature but any service using
one-schema
can use it to quickly add a fully typed API client to this package.Example usage:
https://github.com/lifeomic/phc-sdk-py/assets/21148260/837464c5-aafb-4621-ba98-2e175fdc0a90