Skip to content

Commit

Permalink
(feature): Add support for default values and validation rules (#3640)
Browse files Browse the repository at this point in the history
  • Loading branch information
amckinney committed May 20, 2024
1 parent 558dffb commit 13df267
Show file tree
Hide file tree
Showing 650 changed files with 126,183 additions and 2,997 deletions.
43 changes: 42 additions & 1 deletion fern.schema.dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,32 @@
"type": "object",
"properties": {
"type": { "type": "string" },
"default": {},
"validation": {
"anyOf": [
{
"type": "object",
"properties": {
"minLength": { "type": "number" },
"maxLength": { "type": "number" },
"pattern": { "type": "string" },
"format": { "type": "string" }
},
"additionalProperties": false
},
{
"type": "object",
"properties": {
"min": { "type": "number" },
"max": { "type": "number" },
"exclusiveMin": { "type": "boolean" },
"exclusiveMax": { "type": "boolean" },
"multipleOf": { "type": "number" }
},
"additionalProperties": false
}
]
},
"docs": {
"$ref": "#/properties/types/additionalProperties/anyOf/1/anyOf/0/properties/docs"
},
Expand Down Expand Up @@ -210,7 +236,10 @@
"$ref": "#/properties/types/additionalProperties/anyOf/1/anyOf/0/properties/audiences"
},
"examples": { "$ref": "#/properties/types/additionalProperties/anyOf/1/anyOf/0/properties/examples" },
"type": { "type": "string" }
"type": { "type": "string" },
"validation": {
"$ref": "#/properties/types/additionalProperties/anyOf/1/anyOf/0/properties/properties/additionalProperties/anyOf/1/properties/validation"
}
},
"required": ["type"],
"additionalProperties": false
Expand Down Expand Up @@ -322,6 +351,10 @@
"type": "object",
"properties": {
"type": { "type": "string" },
"default": {},
"validation": {
"$ref": "#/properties/types/additionalProperties/anyOf/1/anyOf/0/properties/properties/additionalProperties/anyOf/1/properties/validation"
},
"docs": { "$ref": "#/properties/types/additionalProperties/anyOf/1/anyOf/0/properties/docs" }
},
"required": ["type"],
Expand Down Expand Up @@ -352,6 +385,10 @@
"type": "object",
"properties": {
"type": { "type": "string" },
"default": {},
"validation": {
"$ref": "#/properties/types/additionalProperties/anyOf/1/anyOf/0/properties/properties/additionalProperties/anyOf/1/properties/validation"
},
"docs": { "$ref": "#/properties/types/additionalProperties/anyOf/1/anyOf/0/properties/docs" },
"availability": {
"$ref": "#/properties/types/additionalProperties/anyOf/1/anyOf/0/properties/availability"
Expand Down Expand Up @@ -413,6 +450,10 @@
"type": "object",
"properties": {
"type": { "type": "string" },
"default": {},
"validation": {
"$ref": "#/properties/types/additionalProperties/anyOf/1/anyOf/0/properties/properties/additionalProperties/anyOf/1/properties/validation"
},
"docs": {
"$ref": "#/properties/types/additionalProperties/anyOf/1/anyOf/0/properties/docs"
},
Expand Down
104 changes: 94 additions & 10 deletions fern.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,32 @@
"type": "object",
"properties": {
"type": { "type": "string" },
"default": {},
"validation": {
"anyOf": [
{
"type": "object",
"properties": {
"minLength": { "type": "number" },
"maxLength": { "type": "number" },
"pattern": { "type": "string" },
"format": { "type": "string" }
},
"additionalProperties": false
},
{
"type": "object",
"properties": {
"min": { "type": "number" },
"max": { "type": "number" },
"exclusiveMin": { "type": "boolean" },
"exclusiveMax": { "type": "boolean" },
"multipleOf": { "type": "number" }
},
"additionalProperties": false
}
]
},
"docs": {
"$ref": "#/properties/types/additionalProperties/anyOf/1/anyOf/0/properties/docs"
},
Expand Down Expand Up @@ -210,7 +236,10 @@
"$ref": "#/properties/types/additionalProperties/anyOf/1/anyOf/0/properties/audiences"
},
"examples": { "$ref": "#/properties/types/additionalProperties/anyOf/1/anyOf/0/properties/examples" },
"type": { "type": "string" }
"type": { "type": "string" },
"validation": {
"$ref": "#/properties/types/additionalProperties/anyOf/1/anyOf/0/properties/properties/additionalProperties/anyOf/1/properties/validation"
}
},
"required": ["type"],
"additionalProperties": false
Expand Down Expand Up @@ -322,6 +351,10 @@
"type": "object",
"properties": {
"type": { "type": "string" },
"default": {},
"validation": {
"$ref": "#/properties/types/additionalProperties/anyOf/1/anyOf/0/properties/properties/additionalProperties/anyOf/1/properties/validation"
},
"docs": { "$ref": "#/properties/types/additionalProperties/anyOf/1/anyOf/0/properties/docs" }
},
"required": ["type"],
Expand Down Expand Up @@ -352,6 +385,10 @@
"type": "object",
"properties": {
"type": { "type": "string" },
"default": {},
"validation": {
"$ref": "#/properties/types/additionalProperties/anyOf/1/anyOf/0/properties/properties/additionalProperties/anyOf/1/properties/validation"
},
"docs": { "$ref": "#/properties/types/additionalProperties/anyOf/1/anyOf/0/properties/docs" },
"availability": {
"$ref": "#/properties/types/additionalProperties/anyOf/1/anyOf/0/properties/availability"
Expand Down Expand Up @@ -413,6 +450,10 @@
"type": "object",
"properties": {
"type": { "type": "string" },
"default": {},
"validation": {
"$ref": "#/properties/types/additionalProperties/anyOf/1/anyOf/0/properties/properties/additionalProperties/anyOf/1/properties/validation"
},
"docs": {
"$ref": "#/properties/types/additionalProperties/anyOf/1/anyOf/0/properties/docs"
},
Expand Down Expand Up @@ -506,7 +547,8 @@
"properties": {
"docs": { "$ref": "#/properties/types/additionalProperties/anyOf/1/anyOf/0/properties/docs" },
"type": { "type": "string" },
"property": { "type": "string" }
"property": { "type": "string" },
"status-code": { "type": "number" }
},
"required": ["type"],
"additionalProperties": false
Expand Down Expand Up @@ -574,14 +616,52 @@
"$ref": "#/properties/service/properties/endpoints/additionalProperties/properties/examples/items/properties/path-parameters/additionalProperties"
},
"response": {
"type": "object",
"properties": {
"error": { "type": "string" },
"body": {
"$ref": "#/properties/service/properties/endpoints/additionalProperties/properties/examples/items/properties/path-parameters/additionalProperties"
"anyOf": [
{
"type": "object",
"properties": {
"error": { "type": "string" },
"body": {
"$ref": "#/properties/service/properties/endpoints/additionalProperties/properties/examples/items/properties/path-parameters/additionalProperties"
}
},
"additionalProperties": false
},
{
"type": "object",
"properties": {
"stream": {
"type": "array",
"items": {
"$ref": "#/properties/service/properties/endpoints/additionalProperties/properties/examples/items/properties/path-parameters/additionalProperties"
}
}
},
"required": ["stream"],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"stream": {
"type": "array",
"items": {
"type": "object",
"properties": {
"event": { "type": "string" },
"data": {
"$ref": "#/properties/service/properties/endpoints/additionalProperties/properties/examples/items/properties/path-parameters/additionalProperties"
}
},
"required": ["event"],
"additionalProperties": false
}
}
},
"required": ["stream"],
"additionalProperties": false
}
},
"additionalProperties": false
]
},
"code-samples": {
"type": "array",
Expand Down Expand Up @@ -918,7 +998,11 @@
"properties": {
"docs": { "$ref": "#/properties/types/additionalProperties/anyOf/1/anyOf/0/properties/docs" },
"status-code": { "type": "number" },
"type": { "type": "string" }
"type": { "type": "string" },
"examples": {
"type": "array",
"items": { "$ref": "#/properties/types/additionalProperties/anyOf/1/anyOf/0/properties/examples/items" }
}
},
"required": ["status-code"],
"additionalProperties": false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,22 @@ exports[`dependencies correctly incorporates dependencies 1`] = `
"_type": "primitive",
"primitive": {
"v1": "STRING",
"v2": null
"v2": {
"type": "string",
"default": null,
"validation": null
}
}
},
"resolvedType": {
"_type": "primitive",
"primitive": {
"v1": "STRING",
"v2": null
"v2": {
"type": "string",
"default": null,
"validation": null
}
}
}
},
Expand Down Expand Up @@ -193,14 +201,22 @@ exports[`dependencies correctly incorporates dependencies 1`] = `
"_type": "primitive",
"primitive": {
"v1": "INTEGER",
"v2": null
"v2": {
"type": "integer",
"default": null,
"validation": null
}
}
},
"resolvedType": {
"_type": "primitive",
"primitive": {
"v1": "INTEGER",
"v2": null
"v2": {
"type": "integer",
"default": null,
"validation": null
}
}
}
},
Expand Down Expand Up @@ -320,14 +336,22 @@ exports[`dependencies correctly incorporates dependencies 1`] = `
"_type": "primitive",
"primitive": {
"v1": "STRING",
"v2": null
"v2": {
"type": "string",
"default": null,
"validation": null
}
}
},
"resolvedType": {
"_type": "primitive",
"primitive": {
"v1": "STRING",
"v2": null
"v2": {
"type": "string",
"default": null,
"validation": null
}
}
}
},
Expand Down Expand Up @@ -815,4 +839,4 @@ exports[`dependencies correctly incorporates dependencies 1`] = `
}"
`;

exports[`dependencies file dependencies 1`] = `2671214`;
exports[`dependencies file dependencies 1`] = `2695212`;
Loading

0 comments on commit 13df267

Please sign in to comment.