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: add products into schema #6516

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
100 changes: 100 additions & 0 deletions docs-yml.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,19 @@
}
]
},
"products": {
"oneOf": [
{
"type": "array",
"items": {
"$ref": "#/definitions/docs.ProductConfig"
}
},
{
"type": "null"
}
]
},
"landing-page": {
"oneOf": [
{
Expand Down Expand Up @@ -796,6 +809,93 @@
],
"additionalProperties": false
},
"docs.ProductConfig": {
"type": "object",
"properties": {
"viewers": {
"oneOf": [
{
"$ref": "#/definitions/docs.Role"
},
{
"type": "null"
}
]
},
"orphaned": {
"oneOf": [
{
"type": "boolean"
},
{
"type": "null"
}
]
},
"feature-flag": {
"oneOf": [
{
"$ref": "#/definitions/docs.FeatureFlagConfiguration"
},
{
"type": "null"
}
]
},
"display-name": {
"type": "string"
},
"subtitle": {
"oneOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"icon": {
"type": "string"
},
"value": {
"type": "string"
},
"path": {
"type": "string"
},
"slug": {
"oneOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"versions": {
"oneOf": [
{
"type": "array",
"items": {
"$ref": "#/definitions/docs.VersionConfig"
}
},
{
"type": "null"
}
]
}
},
"required": [
"display-name",
"icon",
"value",
"path"
],
"additionalProperties": false
},
"docs.PageConfiguration": {
"type": "object",
"properties": {
Expand Down
5,843 changes: 5,843 additions & 0 deletions docs.json

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions fern/apis/docs-yml/definition/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ types:
# navigation
tabs: optional<map<TabId, TabConfig>>
versions: optional<list<VersionConfig>>
products: optional<list<ProductConfig>>
landing-page: optional<PageConfiguration>
navigation:
type: optional<NavigationConfig>
Expand Down Expand Up @@ -1039,3 +1040,24 @@ types:
message:
type: string
docs: The message to display in the announcement bar. Markdown is supported.

ProductConfig:
extends: [WithPermissions, WithFeatureFlags]
properties:
display-name: string
subtitle: optional<string>
icon: string
value: string
path:
type: string
docs: The relative path to the version's docs.yml file.
slug:
type: optional<string>
docs: The "slug" is this version's basePath. If not set, the slug will be generated from the display-name.
versions: optional<list<VersionConfig>>

ProductFileConfig:
properties:
tabs: optional<map<TabId, TabConfig>>
landing-page: optional<PageConfiguration>
navigation: NavigationConfig
3 changes: 2 additions & 1 deletion fern/apis/fern-definition/definition/file.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ imports:
service: service.yml
pagination: pagination.yml
versioning: versioning.yml
products: products.yml
environments: environments.yml
auth: auth.yml
variables: variables.yml
Expand Down Expand Up @@ -77,8 +78,8 @@ types:
idempotency-headers: optional<map<string, service.HttpHeaderSchema>>
variables: optional<map<string, variables.VariableDeclarationSchema>>
pagination: optional<pagination.PaginationSchema>
products: optional<products.ProductDeclarationSchema>
version: optional<versioning.VersionDeclarationSchema>


ErrorDiscriminationSchema:
discriminated: false
Expand Down
43 changes: 43 additions & 0 deletions fern/apis/fern-definition/definition/products.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
imports:
commons: commons.yml
types: types.yml
versioning: versioning.yml

types:
ProductDeclarationSchema:
properties:
default: optional<string>
values: list<ProductValue>
header: ProductDeclarationHeaderSchema

ProductValue:
discriminated: false
union:
- string
- ProductValueDetailed

ProductValueDetailed:
extends:
- commons.WithDocsSchema
- commons.WithName
properties:
value: string
versions: optional<versioning.VersionDeclarationSchema>

ProductDeclarationHeaderSchema:
discriminated: false
union:
- string
- ProductDeclarationHeaderObjectSchema

ProductDeclarationHeaderObjectSchema:
properties:
name:
type: optional<string>
docs: The name of the parameter used to represent the header
env:
type: optional<string>
docs: The environment variable to read the header value from (if any)
value:
type: string
docs: The wire representation of the header (e.g. X-API-Product)
Loading
Loading