seamapi / blueprint

Build tools for the Seam API using this blueprint.
https://blueprint.seam.vc
MIT License
0 stars 0 forks source link

Define Resource and Response #11

Open kainpets opened 2 days ago

kainpets commented 2 days ago

Closes #10 Part of #1

vercel[bot] commented 2 days ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
blueprint ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 1, 2024 0:06am
kainpets commented 2 days ago

Ideally ResourceType can be self consistent, so blueprint.resources[response.resourceType] is always NonNull. Can we do this with a generic or inferred type form the openapi spec?

@razor-x Do you want ResourceType to be dynamically inferred from openapi schema at build time? I guess we could use https://www.npmjs.com/package/openapi-typescript for that or did you have something else in mind?

razor-x commented 2 days ago

@kainpets what we need is a lot simpler than that. We already have typescript types for everything.

I think all we need for now is just type ResourceType = keyof openapi.components.schemas

The resource type properties should come from the schemas

razor-x commented 2 days ago

I think we may need to introduce a generic

export const createBlueprint = ({ openapi }: T extends TypesModule): Blueprint<T> => {