-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
281 additions
and
4 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,19 @@ | ||
import metaSchema, { OpenrpcDocument as OpenRPC } from "@open-rpc/meta-schema"; | ||
import jsonSchema from "@json-schema-tools/meta-schema" | ||
import extensionSchema from "./open-rpc-extensions-schema.json" | ||
|
||
const getMetaSchemaExtended = () => { | ||
const extensionMetaSchemaCopy = { ...extensionSchema } as any; | ||
const metaSchemaCopy = { ...metaSchema } as any; | ||
delete extensionMetaSchemaCopy.$schema; | ||
delete extensionMetaSchemaCopy.$id; | ||
const jsonSchemaCopy = {...jsonSchema} as any; | ||
delete jsonSchemaCopy.$id; | ||
delete jsonSchemaCopy.$schema; | ||
extensionMetaSchemaCopy.properties['x-extensions'].items.properties.schema = jsonSchemaCopy // .schema = jsonSchemaCopy; | ||
metaSchemaCopy.properties['x-extensions'] ={"$ref":"#/definitions/x-extensions"} | ||
metaSchemaCopy.definitions['x-extensions']=extensionMetaSchemaCopy.properties['x-extensions']; | ||
return metaSchemaCopy; | ||
}; | ||
|
||
export default getMetaSchemaExtended; |
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,65 @@ | ||
{ | ||
"openrpc": "1.2.6", | ||
"info": { | ||
"title": "Minimal OpenRPC Example", | ||
"version": "1.0.0" | ||
}, | ||
"methods": [ | ||
{ | ||
"name": "getExampleData", | ||
"summary": "Retrieves example data from the API.", | ||
"x-notification": "fff", | ||
"params": [ | ||
{ | ||
"name": "dataId", | ||
"schema": { | ||
"type": "integer", | ||
"description": "The ID of the data to retrieve." | ||
}, | ||
"required": true | ||
} | ||
], | ||
"result": { | ||
"name": "exampleData", | ||
"schema": { | ||
"type": "object", | ||
"properties": { | ||
"id": { | ||
"type": "integer", | ||
"description": "The ID of the data." | ||
}, | ||
"data": { | ||
"type": "string", | ||
"description": "The content of the data." | ||
} | ||
}, | ||
"required": [ | ||
"id", | ||
"data" | ||
] | ||
}, | ||
"description": "The result object containing the requested data." | ||
} | ||
} | ||
], | ||
"x-extensions": [ | ||
{ | ||
"openrpcExtension": "0.0.0-development", | ||
"name": "x-notification", | ||
"version": "0.0.1", | ||
"description": "Describe a notification for OpenRPC methods", | ||
"summary": "OpenRPC Notification", | ||
"externalDocumentation": { | ||
"description": "github", | ||
"url": "https://github.com/open-rpc/specification-extensions-spec/examples/x-notification-openrpc-ext.json" | ||
}, | ||
"restricted": [ | ||
"methodObject" | ||
], | ||
"schema": { | ||
"type": "boolean", | ||
"description": "wether or not this method is a notification or not" | ||
} | ||
} | ||
] | ||
} |
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,89 @@ | ||
{ | ||
"$schema": "https://meta.json-schema.tools/", | ||
"title": "OpenRPC Specification Extension", | ||
"description": "A standard way to define OpenRPC Specification Extensions. This makes it easier to provide support for Specification Extensions in other tools.", | ||
"type": "object", | ||
"required": [ | ||
"name", | ||
"schema", | ||
"openrpcExtension", | ||
"version" | ||
], | ||
"properties": { | ||
"openrpcExtension": { | ||
"title": "openrpcExtensionVersion", | ||
"description": "**REQUIRED**. This string MUST be the semantic version number of the Specification that the document uses.", | ||
"type": "string", | ||
"enum": [ | ||
"0.0.0-development" | ||
] | ||
}, | ||
"name": { | ||
"title": "specificationExtensionName", | ||
"description": "**REQUIRED** Name of the Specification Extension. MUST start with `x-`", | ||
"type": "string", | ||
"pattern": "^x-", | ||
"examples": [ | ||
"x-foobarbaz" | ||
] | ||
}, | ||
"version": { | ||
"title": "specificationExtensionVersion", | ||
"description": "**REQUIRED**. The version of the Extension (which is distinct from the `openrpcExtension` version and implementation version).", | ||
"type": "string", | ||
"examples": [ | ||
"0.0.1" | ||
] | ||
}, | ||
"required": { | ||
"title": "specificationExtensionRequired", | ||
"type": "boolean", | ||
"description": "wether or not this specification extension is required or not" | ||
}, | ||
"restricted": { | ||
"title": "restrictedObjects", | ||
"description": "A list of object names to restrict the usage of the specification extension to.", | ||
"type": "array", | ||
"items": { | ||
"title": "restrictedObject", | ||
"description": "restricted object", | ||
"type": "string" | ||
} | ||
}, | ||
"description": { | ||
"title": "specificationExtensionDescription", | ||
"type": "string", | ||
"description": "Markdown description describing the specification extension." | ||
}, | ||
"summary": { | ||
"title": "specificationExtensionSummary", | ||
"type": "string", | ||
"description": "A short summary of what the specification extension is." | ||
}, | ||
"schema": { | ||
"$ref": "https://meta.json-schema.tools" | ||
}, | ||
"externalDocumentation": { | ||
"title": "specificationExtensionExternalDocumentationObject", | ||
"type": "object", | ||
"additionalProperties": false, | ||
"description": "Information about specification extension external documentation.", | ||
"required": [ | ||
"url" | ||
], | ||
"properties": { | ||
"description": { | ||
"title": "specificationExtensionexternalDocumentationObjectDescription", | ||
"description": "external documentation description.", | ||
"type": "string" | ||
}, | ||
"url": { | ||
"title": "specificationExtensionexternalDocumentationObjectUrl", | ||
"description": "external documentation description.", | ||
"type": "string", | ||
"format": "uri" | ||
} | ||
} | ||
} | ||
} | ||
} |
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,98 @@ | ||
{ | ||
"$id": "https://extensions.meta.open-rpc.org/", | ||
"title": "OpenRPC Reserved Extension Property", | ||
"type": "object", | ||
"properties": { | ||
"x-extensions": { | ||
"type": "array", | ||
"items": { | ||
"title": "OpenRPC Specification Extension", | ||
"description": "A standard way to define OpenRPC Specification Extensions. This makes it easier to provide support for Specification Extensions in other tools.", | ||
"type": "object", | ||
"required": [ | ||
"name", | ||
"schema", | ||
"openrpcExtension", | ||
"version" | ||
], | ||
"properties": { | ||
"openrpcExtension": { | ||
"title": "openrpcExtensionVersion", | ||
"description": "**REQUIRED**. This string MUST be the semantic version number of the Specification that the document uses.", | ||
"type": "string", | ||
"enum": [ | ||
"0.0.0-development" | ||
] | ||
}, | ||
"name": { | ||
"title": "specificationExtensionName", | ||
"description": "**REQUIRED** Name of the Specification Extension. MUST start with `x-`", | ||
"type": "string", | ||
"pattern": "^x-", | ||
"examples": [ | ||
"x-foobarbaz" | ||
] | ||
}, | ||
"version": { | ||
"title": "specificationExtensionVersion", | ||
"description": "**REQUIRED**. The version of the Extension (which is distinct from the `openrpcExtension` version and implementation version).", | ||
"type": "string", | ||
"examples": [ | ||
"0.0.1" | ||
] | ||
}, | ||
"required": { | ||
"title": "specificationExtensionRequired", | ||
"type": "boolean", | ||
"description": "wether or not this specification extension is required or not" | ||
}, | ||
"restricted": { | ||
"title": "restrictedObjects", | ||
"description": "A list of object names to restrict the usage of the specification extension to.", | ||
"type": "array", | ||
"items": { | ||
"title": "restrictedObject", | ||
"description": "restricted object", | ||
"type": "string" | ||
} | ||
}, | ||
"description": { | ||
"title": "specificationExtensionDescription", | ||
"type": "string", | ||
"description": "Markdown description describing the specification extension." | ||
}, | ||
"summary": { | ||
"title": "specificationExtensionSummary", | ||
"type": "string", | ||
"description": "A short summary of what the specification extension is." | ||
}, | ||
"schema": { | ||
"$ref": "https://meta.json-schema.tools" | ||
}, | ||
"externalDocumentation": { | ||
"title": "specificationExtensionExternalDocumentationObject", | ||
"type": "object", | ||
"additionalProperties": false, | ||
"description": "Information about specification extension external documentation.", | ||
"required": [ | ||
"url" | ||
], | ||
"properties": { | ||
"description": { | ||
"title": "specificationExtensionexternalDocumentationObjectDescription", | ||
"description": "external documentation description.", | ||
"type": "string" | ||
}, | ||
"url": { | ||
"title": "specificationExtensionexternalDocumentationObjectUrl", | ||
"description": "external documentation description.", | ||
"type": "string", | ||
"format": "uri" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
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