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(clover): Add vallidation for required fields #5476

Merged
merged 1 commit into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from all 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: 8 additions & 8 deletions bin/clover/src/cfDb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,19 @@ export type CfProperty =
];
}>;

type CfBooleanProperty = JSONSchema.Boolean;
export type CfBooleanProperty = JSONSchema.Boolean;

type CfStringProperty = JSONSchema.String;
export type CfStringProperty = JSONSchema.String;

type CfNumberProperty = JSONSchema.Number & {
export type CfNumberProperty = JSONSchema.Number & {
format?: string;
};

type CfIntegerProperty = JSONSchema.Integer & {
export type CfIntegerProperty = JSONSchema.Integer & {
format?: string;
};

type CfArrayProperty = Extend<JSONSchema.Array, {
export type CfArrayProperty = Extend<JSONSchema.Array, {
// For properties of type array, defines the data structure of each array item.
// Contains a single schema. A list of schemas is not allowed.
items: CfProperty;
Expand All @@ -60,7 +60,7 @@ type CfArrayProperty = Extend<JSONSchema.Array, {
insertionOrder?: boolean;
}>;

type CfObjectProperty = Extend<JSONSchema.Object, {
export type CfObjectProperty = Extend<JSONSchema.Object, {
properties?: Record<string, CfProperty>;
// e.g. patternProperties: { "^[a-z]+": { type: "string" } }
patternProperties?: Record<string, CfProperty>;
Expand Down Expand Up @@ -261,7 +261,7 @@ function isCfObjectProperty(prop: CfProperty): prop is CfObjectProperty {
"patternProperties" in prop;
}

export interface CfSchema extends JSONSchema.Interface {
export type CfSchema = Extend<CfObjectProperty, {
typeName: string;
description: string;
primaryIdentifier: JSONPointer[];
Expand Down Expand Up @@ -307,7 +307,7 @@ export interface CfSchema extends JSONSchema.Interface {
mappings: Record<string, JSONPointer>;
};
propertyTransform?: Record<string, string>;
}
}>;

type CfDb = Record<string, CfSchema>;
const DB: CfDb = {};
Expand Down
2 changes: 1 addition & 1 deletion bin/clover/src/spec/pkgs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export type ExpandedSchemaVariantSpec = Extend<SchemaVariantSpec, {
data: NonNullable<SchemaVariantSpecData>;
sockets: ExpandedSocketSpec[];
domain: ExpandedPropSpecFor["object"];
secrets: ExpandedPropSpec;
secrets: ExpandedPropSpecFor["object"];
secretDefinition: ExpandedPropSpec | null;
resourceValue: ExpandedPropSpecFor["object"];
}>;
Loading