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
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/lib/blueprint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type { Openapi } from './openapi.js'
export interface Blueprint {
name: string
routes: Route[]
resources: Record<string, Resource>
}

interface Route {
Expand All @@ -12,6 +13,11 @@ interface Route {
subroutes: Route[]
}

interface Resource {
resourceType: string
properties: Property[]
}

interface Namespace {
path: string
}
Expand Down Expand Up @@ -49,6 +55,15 @@ interface Request {

interface Response {
description: string
responseType: 'resource' | 'resource_list' | 'void'
responseKey: string | null
resourceType: string | null
}
razor-x marked this conversation as resolved.
Show resolved Hide resolved

interface Property {
name: string
type: 'string' | 'enum' | 'record' | 'list' | 'object'
kainpets marked this conversation as resolved.
Show resolved Hide resolved
properties: Property[] | null
}
razor-x marked this conversation as resolved.
Show resolved Hide resolved

type Method = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH'
Expand All @@ -61,5 +76,6 @@ export const createBlueprint = ({ openapi }: TypesModule): Blueprint => {
return {
name: openapi.info.title,
routes: [],
resources: {},
}
}
1 change: 1 addition & 0 deletions test/snapshots/blueprint.test.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ Generated by [AVA](https://avajs.dev).

{
name: 'Foo',
resources: {},
routes: [],
}
Binary file modified test/snapshots/blueprint.test.ts.snap
Binary file not shown.
1 change: 1 addition & 0 deletions test/snapshots/seam-blueprint.test.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ Generated by [AVA](https://avajs.dev).

{
name: 'Seam Connect',
resources: {},
routes: [],
}
Binary file modified test/snapshots/seam-blueprint.test.ts.snap
Binary file not shown.