forked from Redocly/redocly-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add typings and interfaces for Overlay Specification v1.0.0
* updated references to use defined NodeTypes. * update `any` to `unknown` * run prettier * rebase latest changes from main * refactor to match Redocly#1898 type definitions related Redocly#1246
- Loading branch information
1 parent
f0446c7
commit ac0c9a2
Showing
6 changed files
with
68 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@redocly/openapi-core": minor | ||
"@redocly/cli": minor | ||
--- | ||
|
||
Add typings and interfaces for Overlay Specification v1.0.0 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { type NodeType, listOf } from '.'; | ||
|
||
const Root: NodeType = { | ||
properties: { | ||
overlay: { type: 'string' }, | ||
info: 'Info', | ||
extends: { type: 'string' }, | ||
actions: 'Actions', | ||
}, | ||
required: ['overlay', 'info', 'actions'], | ||
extensionsPrefix: 'x-', | ||
}; | ||
|
||
const Info: NodeType = { | ||
properties: { | ||
title: { type: 'string' }, | ||
version: { type: 'string' }, | ||
}, | ||
required: ['title', 'version'], | ||
extensionsPrefix: 'x-', | ||
}; | ||
|
||
const Actions: NodeType = listOf('Action'); | ||
const Action: NodeType = { | ||
properties: { | ||
target: { type: 'string' }, | ||
description: { type: 'string' }, | ||
update: {}, // any | ||
remove: { type: 'boolean' }, | ||
}, | ||
required: ['target'], | ||
extensionsPrefix: 'x-', | ||
}; | ||
|
||
export const Overlay1Types: Record<string, NodeType> = { | ||
Root, | ||
Info, | ||
Actions, | ||
Action, | ||
}; |
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,19 @@ | ||
export interface InfoObject { | ||
title: string; | ||
version: string; | ||
} | ||
|
||
export interface ActionObject { | ||
target: string; | ||
description?: string; | ||
update?: unknown; | ||
remove?: boolean; | ||
} | ||
export interface Overlay1Definition { | ||
overlay: '1.0.0'; | ||
info: InfoObject; | ||
extends?: string; | ||
actions: ActionObject[]; | ||
} | ||
|
||
export const VERSION_PATTERN = /^1\.0\.\d+(-.+)?$/; |