Skip to content

Commit

Permalink
Move inline to BaseTypeDeclarationSchema in Fern definition, remove r…
Browse files Browse the repository at this point in the history
…edundant inline property from IR shapes
  • Loading branch information
Swimburger committed Nov 26, 2024
1 parent c0e8130 commit 64227b1
Show file tree
Hide file tree
Showing 108 changed files with 2,699 additions and 1,412 deletions.
90 changes: 50 additions & 40 deletions fern.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,16 @@
}
]
},
"inline": {
"oneOf": [
{
"type": "boolean"
},
{
"type": "null"
}
]
},
"docs": {
"oneOf": [
{
Expand Down Expand Up @@ -530,16 +540,6 @@
}
]
},
"inline": {
"oneOf": [
{
"type": "boolean"
},
{
"type": "null"
}
]
},
"extends": {
"oneOf": [
{
Expand Down Expand Up @@ -710,6 +710,16 @@
}
]
},
"inline": {
"oneOf": [
{
"type": "boolean"
},
{
"type": "null"
}
]
},
"docs": {
"oneOf": [
{
Expand Down Expand Up @@ -743,16 +753,6 @@
}
]
},
"inline": {
"oneOf": [
{
"type": "boolean"
},
{
"type": "null"
}
]
},
"default": {
"oneOf": [
{
Expand Down Expand Up @@ -1053,6 +1053,16 @@
}
]
},
"inline": {
"oneOf": [
{
"type": "boolean"
},
{
"type": "null"
}
]
},
"docs": {
"oneOf": [
{
Expand Down Expand Up @@ -1086,16 +1096,6 @@
}
]
},
"inline": {
"oneOf": [
{
"type": "boolean"
},
{
"type": "null"
}
]
},
"discriminant": {
"oneOf": [
{
Expand Down Expand Up @@ -1219,6 +1219,16 @@
}
]
},
"inline": {
"oneOf": [
{
"type": "boolean"
},
{
"type": "null"
}
]
},
"docs": {
"oneOf": [
{
Expand Down Expand Up @@ -1252,16 +1262,6 @@
}
]
},
"inline": {
"oneOf": [
{
"type": "boolean"
},
{
"type": "null"
}
]
},
"discriminated": {
"const": false
},
Expand Down Expand Up @@ -1314,6 +1314,16 @@
}
]
},
"inline": {
"oneOf": [
{
"type": "boolean"
},
{
"type": "null"
}
]
},
"docs": {
"oneOf": [
{
Expand Down
4 changes: 0 additions & 4 deletions fern/apis/fern-definition/definition/commons.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ types:
properties:
audiences: optional<list<string>>

WithInline:
properties:
inline: optional<boolean>

DeclarationSchema:
extends:
- WithDocsSchema
Expand Down
17 changes: 5 additions & 12 deletions fern/apis/fern-definition/definition/types.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ types:
examples: optional<list<examples.ExampleTypeSchema>>
encoding: optional<encoding.EncodingSchema>
source: optional<source.SourceSchema>
inline: optional<boolean>

### Aliases ####

Expand All @@ -102,9 +103,7 @@ types:
#### Objects ####

ObjectSchema:
extends:
- BaseTypeDeclarationSchema
- commons.WithInline
extends: BaseTypeDeclarationSchema
properties:
extends: optional<ObjectExtendsSchema>
properties: optional<map<string, ObjectPropertySchema>>
Expand All @@ -127,9 +126,7 @@ types:
#### Enums ####

EnumSchema:
extends:
- BaseTypeDeclarationSchema
- commons.WithInline
extends: BaseTypeDeclarationSchema
properties:
default: optional<string>
enum: list<EnumValue>
Expand Down Expand Up @@ -186,9 +183,7 @@ types:
value: string

DiscriminatedUnionSchema:
extends:
- BaseTypeDeclarationSchema
- commons.WithInline
extends: BaseTypeDeclarationSchema
properties:
discriminant: optional<UnionDiscriminant>
extends: optional<ObjectExtendsSchema>
Expand All @@ -210,9 +205,7 @@ types:
#### Undiscriminated Union ####

UndiscriminatedUnionSchema:
extends:
- BaseTypeDeclarationSchema
- commons.WithInline
extends: BaseTypeDeclarationSchema
properties:
discriminated: literal<false>
union: list<SingleUndiscriminatedUnionTypeSchema>
Expand Down
90 changes: 50 additions & 40 deletions package-yml.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,16 @@
}
]
},
"inline": {
"oneOf": [
{
"type": "boolean"
},
{
"type": "null"
}
]
},
"docs": {
"oneOf": [
{
Expand Down Expand Up @@ -550,16 +560,6 @@
}
]
},
"inline": {
"oneOf": [
{
"type": "boolean"
},
{
"type": "null"
}
]
},
"extends": {
"oneOf": [
{
Expand Down Expand Up @@ -730,6 +730,16 @@
}
]
},
"inline": {
"oneOf": [
{
"type": "boolean"
},
{
"type": "null"
}
]
},
"docs": {
"oneOf": [
{
Expand Down Expand Up @@ -763,16 +773,6 @@
}
]
},
"inline": {
"oneOf": [
{
"type": "boolean"
},
{
"type": "null"
}
]
},
"default": {
"oneOf": [
{
Expand Down Expand Up @@ -1073,6 +1073,16 @@
}
]
},
"inline": {
"oneOf": [
{
"type": "boolean"
},
{
"type": "null"
}
]
},
"docs": {
"oneOf": [
{
Expand Down Expand Up @@ -1106,16 +1116,6 @@
}
]
},
"inline": {
"oneOf": [
{
"type": "boolean"
},
{
"type": "null"
}
]
},
"discriminant": {
"oneOf": [
{
Expand Down Expand Up @@ -1239,6 +1239,16 @@
}
]
},
"inline": {
"oneOf": [
{
"type": "boolean"
},
{
"type": "null"
}
]
},
"docs": {
"oneOf": [
{
Expand Down Expand Up @@ -1272,16 +1282,6 @@
}
]
},
"inline": {
"oneOf": [
{
"type": "boolean"
},
{
"type": "null"
}
]
},
"discriminated": {
"const": false
},
Expand Down Expand Up @@ -1334,6 +1334,16 @@
}
]
},
"inline": {
"oneOf": [
{
"type": "boolean"
},
{
"type": "null"
}
]
},
"docs": {
"oneOf": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,12 @@ function convertPropertyTypeReferenceToTypeDefinition({
}
}

/**
* Returns whether the declaration should be inlined.
* If a declaration is nested within another declaration, it should be inlined.
* @param declarationDepth Keeps track of how nested the declaration is.
* @returns `true` if the declaration should be inlined, `undefined` otherwise.
*/
function getInline(declarationDepth: number): boolean | undefined {
return declarationDepth > 0 ? true : undefined;
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ export * from "./WithName";
export * from "./WithAvailability";
export * from "./WithDisplayName";
export * from "./WithAudiences";
export * from "./WithInline";
export * from "./DeclarationSchema";
export * from "./DeclarationWithoutDocsSchema";
export * from "./DeclarationWithNameSchema";
Loading

0 comments on commit 64227b1

Please sign in to comment.