-
Notifications
You must be signed in to change notification settings - Fork 155
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
related #1246
- Loading branch information
1 parent
6522bc0
commit a48e89f
Showing
3 changed files
with
71 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { type NodeType, NormalizedScalarSchema, listOf } from '.'; | ||
|
||
const Root: NodeType = { | ||
properties: { | ||
overlay: { type: 'string' }, | ||
info: 'Info', | ||
extends: { type: 'string' }, | ||
actions: listOf('action'), | ||
}, | ||
required: ['overlay', 'info', 'actions'], | ||
extensionsPrefix: 'x-', | ||
}; | ||
|
||
const Info: NodeType = { | ||
properties: { | ||
title: { type: 'string' }, | ||
version: { type: 'string' }, | ||
}, | ||
required: ['title', 'version'], | ||
extensionsPrefix: 'x-', | ||
}; | ||
|
||
const Extends: NormalizedScalarSchema = { | ||
type: 'string', | ||
resolvable: true, | ||
}; | ||
|
||
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 OverlayTypes: Record<string, NodeType | NormalizedScalarSchema> = { | ||
Root, | ||
Info, | ||
Extends, | ||
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?: any; | ||
remove?: boolean; | ||
} | ||
export interface OverlayDefinition { | ||
overlay: '1.0.0'; | ||
info: InfoObject; | ||
extends?: string; | ||
actions: ActionObject[]; | ||
} | ||
|
||
export const VERSION_PATTERN = /^1\.0\.\d+(-.+)?$/; |