-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cli): allow configuring example depth (#5465)
- Loading branch information
Showing
28 changed files
with
748 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
## 0.46.11 | ||
**`(fix):`** Allow for configuring the depth of example generation in API Docs. For example, | ||
if you want to generate optional properties that are 5 levels deep, you can add | ||
the following configuration in your `generators.yml` | ||
|
||
```yml generators.yml | ||
api: | ||
specs: | ||
- openapi: ./openapi.json | ||
settings: | ||
example-generation: | ||
response: | ||
max-depth: 10 | ||
``` | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
118 changes: 118 additions & 0 deletions
118
...enapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-docs/example-depth.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
{ | ||
"absoluteFilePath": "/DUMMY_PATH", | ||
"importedDefinitions": {}, | ||
"namedDefinitionFiles": { | ||
"__package__.yml": { | ||
"absoluteFilepath": "/DUMMY_PATH", | ||
"contents": { | ||
"service": { | ||
"auth": false, | ||
"base-path": "", | ||
"endpoints": { | ||
"getTree": { | ||
"auth": false, | ||
"display-name": "Get tree", | ||
"docs": undefined, | ||
"examples": [ | ||
{ | ||
"response": { | ||
"body": { | ||
"value": "root", | ||
}, | ||
}, | ||
}, | ||
], | ||
"method": "GET", | ||
"pagination": undefined, | ||
"path": "/tree", | ||
"response": { | ||
"docs": "Successfully retrieved tree", | ||
"type": "TreeNode", | ||
}, | ||
"source": { | ||
"openapi": "../openapi.yml", | ||
}, | ||
}, | ||
}, | ||
"source": { | ||
"openapi": "../openapi.yml", | ||
}, | ||
}, | ||
"types": { | ||
"TreeNode": { | ||
"docs": undefined, | ||
"inline": undefined, | ||
"properties": { | ||
"left": { | ||
"docs": "Child nodes of this tree node", | ||
"type": "optional<TreeNode>", | ||
}, | ||
"right": { | ||
"docs": "Child nodes of this tree node", | ||
"type": "optional<TreeNode>", | ||
}, | ||
"value": { | ||
"docs": "The value stored in this node", | ||
"type": "optional<string>", | ||
}, | ||
}, | ||
"source": { | ||
"openapi": "../openapi.yml", | ||
}, | ||
}, | ||
}, | ||
}, | ||
"rawContents": "service: | ||
auth: false | ||
base-path: '' | ||
endpoints: | ||
getTree: | ||
path: /tree | ||
method: GET | ||
auth: false | ||
source: | ||
openapi: ../openapi.yml | ||
display-name: Get tree | ||
response: | ||
docs: Successfully retrieved tree | ||
type: TreeNode | ||
examples: | ||
- response: | ||
body: | ||
value: root | ||
source: | ||
openapi: ../openapi.yml | ||
types: | ||
TreeNode: | ||
properties: | ||
value: | ||
type: optional<string> | ||
docs: The value stored in this node | ||
left: | ||
type: optional<TreeNode> | ||
docs: Child nodes of this tree node | ||
right: | ||
type: optional<TreeNode> | ||
docs: Child nodes of this tree node | ||
source: | ||
openapi: ../openapi.yml | ||
", | ||
}, | ||
}, | ||
"packageMarkers": {}, | ||
"rootApiFile": { | ||
"contents": { | ||
"display-name": "Tree API", | ||
"error-discrimination": { | ||
"strategy": "status-code", | ||
}, | ||
"name": "api", | ||
}, | ||
"defaultUrl": undefined, | ||
"rawContents": "name: api | ||
error-discrimination: | ||
strategy: status-code | ||
display-name: Tree API | ||
", | ||
}, | ||
} |
53 changes: 53 additions & 0 deletions
53
...enapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-ir-in-memory/example-depth.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
{ | ||
"type": "openapi", | ||
"value": { | ||
"openapi": "3.0.0", | ||
"info": { | ||
"title": "Tree API", | ||
"version": "1.0.0", | ||
"description": "API for working with tree data structures" | ||
}, | ||
"paths": { | ||
"/tree": { | ||
"get": { | ||
"summary": "Get tree", | ||
"operationId": "getTree", | ||
"responses": { | ||
"200": { | ||
"description": "Successfully retrieved tree", | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"$ref": "#/components/schemas/TreeNode" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"components": { | ||
"schemas": { | ||
"TreeNode": { | ||
"type": "object", | ||
"properties": { | ||
"value": { | ||
"type": "string", | ||
"description": "The value stored in this node", | ||
"example": "root" | ||
}, | ||
"left": { | ||
"description": "Child nodes of this tree node", | ||
"$ref": "#/components/schemas/TreeNode" | ||
}, | ||
"right": { | ||
"description": "Child nodes of this tree node", | ||
"$ref": "#/components/schemas/TreeNode" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.