Seam API always returns complete resources, so something like this should work
interface Response {
responseType: 'resource' | 'resource_list' | 'void'
responseKey: string | null // access_codes
resourceType: ResourceType | null // access_code
}
interface Blueprint {
resources: Record<ResourceType, Resource>
...
}
interface Resource {
resourceType: ResourceType
properties: Property[]
}
interface Property {
name: string
type: 'string' | 'enum' | 'record' | 'list' | 'object' // unsure about this one
properties: Property[] | null // only defined if type is 'object'
}
Ideally ResourceType can be self consistent, so blueprint.resources[response.resourceType] is always NonNull<Resource>. Can we do this with a generic or inferred type form the openapi spec?
Seam API always returns complete resources, so something like this should work
Ideally ResourceType can be self consistent, so
blueprint.resources[response.resourceType]
is alwaysNonNull<Resource>
. Can we do this with a generic or inferred type form the openapi spec?