Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Define Resource and Response #11

Merged
merged 8 commits into from
Jul 2, 2024
Merged

Conversation

kainpets
Copy link
Contributor

Closes #10
Part of #1

@kainpets kainpets requested a review from a team as a code owner June 28, 2024 11:27
Copy link

vercel bot commented Jun 28, 2024

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 2, 2024 7:53pm

@kainpets
Copy link
Contributor Author

kainpets commented Jun 28, 2024

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?

@kainpets kainpets marked this pull request as draft June 28, 2024 11:35
@razor-x
Copy link
Collaborator

razor-x commented Jun 28, 2024

@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
Copy link
Collaborator

razor-x commented Jun 28, 2024

I think we may need to introduce a generic

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

src/lib/blueprint.ts Outdated Show resolved Hide resolved
@kainpets kainpets marked this pull request as ready for review July 1, 2024 00:08
Copy link
Collaborator

@razor-x razor-x left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestions are optional and compatible with current types if we want to implement them later.

src/lib/blueprint.ts Outdated Show resolved Hide resolved
src/lib/blueprint.ts Outdated Show resolved Hide resolved
@razor-x razor-x changed the title Define Resource and Response feat: Define Resource and Response Jul 2, 2024
src/lib/blueprint.ts Outdated Show resolved Hide resolved
src/lib/blueprint.ts Outdated Show resolved Hide resolved
src/lib/blueprint.ts Outdated Show resolved Hide resolved
src/lib/blueprint.ts Outdated Show resolved Hide resolved
src/lib/blueprint.ts Outdated Show resolved Hide resolved
src/lib/blueprint.ts Outdated Show resolved Hide resolved
src/lib/blueprint.ts Outdated Show resolved Hide resolved
@kainpets kainpets merged commit 810966b into main Jul 2, 2024
16 checks passed
@kainpets kainpets deleted the define-response-and-resource branch July 2, 2024 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Define Resource and Response interfaces
3 participants