Skip to content

Commit

Permalink
Merge pull request #5476 from systeminit/clover/validation
Browse files Browse the repository at this point in the history
feat(clover): Add vallidation for required fields
  • Loading branch information
jkeiser authored Feb 14, 2025
2 parents bf6e690 + 044c0ed commit b5b4e4d
Show file tree
Hide file tree
Showing 4 changed files with 161 additions and 159 deletions.
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

0 comments on commit b5b4e4d

Please sign in to comment.