Skip to content

Commit

Permalink
Merge branch 'master' into fix/go-editor-config
Browse files Browse the repository at this point in the history
  • Loading branch information
BelfordZ authored Apr 16, 2021
2 parents 9fce81f + cd8f0bd commit 3fc5979
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 10 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## [1.14.1](https://github.com/open-rpc/meta-schema/compare/1.14.0...1.14.1) (2021-03-15)


### Bug Fixes

* allow methods array to have refs ([709a380](https://github.com/open-rpc/meta-schema/commit/709a3808f5b712f9fc07dd8a54a66f213924d41e))
* **github action:** eslint workflow node version ([a51cc70](https://github.com/open-rpc/meta-schema/commit/a51cc70cbef90342b1e1130164bd54b50774023f))

# [1.14.0](https://github.com/open-rpc/meta-schema/compare/1.13.20...1.14.0) (2020-11-10)


Expand Down
3 changes: 2 additions & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,8 @@ export interface MethodObject {
externalDocs?: ExternalDocumentationObject;
[regex: string]: SpecificationExtension | any;
}
export type Methods = MethodObject[];
export type MethodReference = MethodObject | ReferenceObject;
export type Methods = MethodReference[];
export interface SchemaComponents { [key: string]: any; }
export interface LinkComponents { [key: string]: any; }
export interface ErrorComponents { [key: string]: any; }
Expand Down
2 changes: 1 addition & 1 deletion index.js

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion index.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,9 @@ class MethodObject(TypedDict):
deprecated: Optional[MethodObjectDeprecated]
externalDocs: Optional[ExternalDocumentationObject]

Methods = NewType("Methods", List[MethodObject])
MethodReference = NewType("MethodReference", Union[MethodObject, ReferenceObject])

Methods = NewType("Methods", List[MethodReference])

SchemaComponents = NewType("SchemaComponents", Mapping[Any, Any])

Expand Down
7 changes: 6 additions & 1 deletion index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,12 @@ pub struct MethodObject {
pub(crate) deprecated: Option<MethodObjectDeprecated>,
pub(crate) externalDocs: Option<ExternalDocumentationObject>,
}
pub type Methods = Vec<MethodObject>;
#[derive(Serialize, Deserialize)]
pub enum MethodReference {
MethodObject,
ReferenceObject
}
pub type Methods = Vec<MethodReference>;
pub type SchemaComponents = HashMap<String, Option<serde_json::Value>>;
pub type LinkComponents = HashMap<String, Option<serde_json::Value>>;
pub type ErrorComponents = HashMap<String, Option<serde_json::Value>>;
Expand Down
34 changes: 32 additions & 2 deletions openrpc_document.go

Large diffs are not rendered by default.

12 changes: 10 additions & 2 deletions schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,15 @@
"type": "array",
"additionalItems": false,
"items": {
"$ref": "#/definitions/methodObject"
"title": "methodOrReference",
"oneOf": [
{
"$ref": "#/definitions/methodObject"
},
{
"$ref": "#/definitions/referenceObject"
}
]
}
},
"components": {
Expand Down Expand Up @@ -120,7 +128,7 @@
"JSONSchema": {
"$ref": "https://raw.githubusercontent.com/json-schema-tools/meta-schema/1.5.9/src/schema.json"
},
"referenceObject": {
"referenceObject": {
"title": "referenceObject",
"type": "object",
"additionalProperties": false,
Expand Down
4 changes: 2 additions & 2 deletions src/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe("meta-schema", () => {
const dereffed = await deref.resolve();
expect(dereffed).toBeTruthy();
expect(dereffed.definitions).not.toBeDefined();
expect(dereffed.properties.methods.items.properties.result.oneOf[0].properties.schema.title).toBe("JSONSchema");
expect(dereffed.properties.methods.items.properties.result.oneOf[1].title).toBe("referenceObject");
expect(dereffed.properties.methods.items.oneOf[0].properties.result.oneOf[0].properties.schema.title).toBe("JSONSchema");
expect(dereffed.properties.methods.items.oneOf[0].properties.result.oneOf[1].title).toBe("referenceObject");
});
});

0 comments on commit 3fc5979

Please sign in to comment.