Skip to content

Commit

Permalink
fix: default values not required (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
ffMathy authored Feb 15, 2024
1 parent 44a7bf1 commit 3ecda9e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 17 deletions.
14 changes: 7 additions & 7 deletions source/__snapshots__/default-ftrack-schema.snap
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export interface State {
}
export interface AssetType {
assets?: Asset[];
component: string;
component?: string;
readonly id: string;
name: string;
short: string;
Expand Down Expand Up @@ -103,7 +103,7 @@ export interface TypedContextLink {
metadata?: Metadata[];
to?: TypedContext;
to_id: string;
type: string;
type?: string;
__entity_type__?: "TypedContextLink";
__permissions?: Record<string, any>;
}
Expand Down Expand Up @@ -209,7 +209,7 @@ export interface Appointment {
}
export interface TaskTypeSchema {
readonly id: string;
name: string;
name?: string;
types?: Type[];
__entity_type__?: "TaskTypeSchema";
__permissions?: Record<string, any>;
Expand Down Expand Up @@ -782,7 +782,7 @@ export interface ListCategory {
}
export interface WorkflowSchema {
readonly id: string;
name: string;
name?: string;
overrides?: ProjectSchemaOverride[];
statuses?: Status[];
__entity_type__?: "WorkflowSchema";
Expand Down Expand Up @@ -958,7 +958,7 @@ export interface ObjectType {
icon: string;
readonly id: string;
is_leaf?: boolean;
is_prioritizable: boolean;
is_prioritizable?: boolean;
is_schedulable: boolean;
is_statusable: boolean;
is_taskable: boolean;
Expand Down Expand Up @@ -1012,7 +1012,7 @@ export interface AssetVersionStatusChange
export interface Setting {
readonly group: string;
readonly name: string;
value: string;
value?: string;
__entity_type__?: "Setting";
__permissions?: Record<string, any>;
}
Expand Down Expand Up @@ -1079,7 +1079,7 @@ export interface List {
owner?: User;
project?: Project;
project_id: string;
system_type: string;
system_type?: string;
user_id?: string;
__entity_type__?: "List";
__permissions?: Record<string, any>;
Expand Down
14 changes: 7 additions & 7 deletions source/__snapshots__/default-highway-test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export interface State {
}
export interface AssetType {
assets?: Asset[];
component: string;
component?: string;
readonly id: string;
name: string;
short: string;
Expand Down Expand Up @@ -103,7 +103,7 @@ export interface TypedContextLink {
metadata?: Metadata[];
to?: TypedContext;
to_id: string;
type: string;
type?: string;
__entity_type__?: "TypedContextLink";
__permissions?: Record<string, any>;
}
Expand Down Expand Up @@ -209,7 +209,7 @@ export interface Appointment {
}
export interface TaskTypeSchema {
readonly id: string;
name: string;
name?: string;
types?: Type[];
__entity_type__?: "TaskTypeSchema";
__permissions?: Record<string, any>;
Expand Down Expand Up @@ -782,7 +782,7 @@ export interface ListCategory {
}
export interface WorkflowSchema {
readonly id: string;
name: string;
name?: string;
overrides?: ProjectSchemaOverride[];
statuses?: Status[];
__entity_type__?: "WorkflowSchema";
Expand Down Expand Up @@ -958,7 +958,7 @@ export interface ObjectType {
icon: string;
readonly id: string;
is_leaf?: boolean;
is_prioritizable: boolean;
is_prioritizable?: boolean;
is_schedulable: boolean;
is_statusable: boolean;
is_taskable: boolean;
Expand Down Expand Up @@ -1012,7 +1012,7 @@ export interface AssetVersionStatusChange
export interface Setting {
readonly group: string;
readonly name: string;
value: string;
value?: string;
__entity_type__?: "Setting";
__permissions?: Record<string, any>;
}
Expand Down Expand Up @@ -1079,7 +1079,7 @@ export interface List {
owner?: User;
project?: Project;
project_id: string;
system_type: string;
system_type?: string;
user_id?: string;
__entity_type__?: "List";
__permissions?: Record<string, any>;
Expand Down
4 changes: 1 addition & 3 deletions source/convertSchemaToInterface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,7 @@ function convertPropertiesToTypes(
}

const isRequired =
schema.required?.includes(key) ||
schema.primary_key?.includes(key) ||
("default" in value && !!value.default);
schema.required?.includes(key) || schema.primary_key?.includes(key);

let type;
if ("$ref" in value && value.$ref) {
Expand Down

0 comments on commit 3ecda9e

Please sign in to comment.