-
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.
wip: use quicktype for typegen; add schemas for common, DS
Signed-off-by: Trae Yelovich <[email protected]>
- Loading branch information
Showing
39 changed files
with
2,267 additions
and
17 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,15 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"title": "IRpcRequest", | ||
"x-typescript-type": "IRpcRequest", | ||
"description": "Interface for RPC request objects", | ||
"type": "object", | ||
"properties": { | ||
"command": { | ||
"type": "string" | ||
} | ||
}, | ||
"required": [ | ||
"command" | ||
] | ||
} |
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,13 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"title": "IRpcResponse", | ||
"x-typescript-type": "IRpcResponse", | ||
"description": "Interface for RPC response objects", | ||
"type": "object", | ||
"properties": { | ||
"success": { | ||
"type": "boolean" | ||
} | ||
}, | ||
"required": [] | ||
} |
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,20 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"title": "Request", | ||
"x-typescript-type": "ListDatasets.Request", | ||
"description": "Request to list datasets matching a pattern", | ||
"type": "object", | ||
"properties": { | ||
"pattern": { | ||
"type": "string", | ||
"description": "Dataset name pattern to match" | ||
}, | ||
"attributes": { | ||
"type": "boolean", | ||
"description": "Whether to include dataset attributes" | ||
} | ||
}, | ||
"required": [ | ||
"pattern" | ||
] | ||
} |
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,41 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"title": "ListDatasetsResponse", | ||
"x-typescript-type": "ListDatasets.Response", | ||
"description": "Response containing list of datasets", | ||
"type": "object", | ||
"allOf": [ | ||
{ | ||
"$ref": "../../common/IRpcResponse.schema.json" | ||
} | ||
], | ||
"properties": { | ||
"items": { | ||
"type": "array", | ||
"items": { | ||
"title": "Dataset", | ||
"type": "object", | ||
"properties": { | ||
"name": { | ||
"type": "string" | ||
}, | ||
"dsorg": { | ||
"type": "string" | ||
}, | ||
"volser": { | ||
"type": "string" | ||
} | ||
}, | ||
"required": ["name", "dsorg", "volser"] | ||
} | ||
}, | ||
"returnedRows": { | ||
"type": "integer", | ||
"description": "Number of datasets returned" | ||
} | ||
}, | ||
"required": [ | ||
"items", | ||
"returnedRows" | ||
] | ||
} |
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,22 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"title": "Request", | ||
"x-typescript-type": "ListDsMembers.Request", | ||
"description": "Request to list members of a dataset", | ||
"type": "object", | ||
"allOf": [ | ||
{ | ||
"$ref": "../../common/IRpcRequest.schema.json" | ||
} | ||
], | ||
"properties": { | ||
"dsname": { | ||
"type": "string", | ||
"description": "Dataset name to list members from" | ||
} | ||
}, | ||
"required": [ | ||
"command", | ||
"dsname" | ||
] | ||
} |
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,34 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"title": "Response", | ||
"x-typescript-type": "ListDsMembers.Response", | ||
"description": "Response containing list of dataset members", | ||
"type": "object", | ||
"allOf": [ | ||
{ | ||
"$ref": "../../common/IRpcResponse.schema.json" | ||
} | ||
], | ||
"properties": { | ||
"items": { | ||
"type": "array", | ||
"items": { | ||
"type": "object", | ||
"properties": { | ||
"name": { | ||
"type": "string" | ||
} | ||
}, | ||
"required": ["name"] | ||
} | ||
}, | ||
"returnedRows": { | ||
"type": "integer", | ||
"description": "Number of members returned" | ||
} | ||
}, | ||
"required": [ | ||
"items", | ||
"returnedRows" | ||
] | ||
} |
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,26 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"title": "Request", | ||
"x-typescript-type": "ReadDataset.Request", | ||
"description": "Request to read contents of a dataset", | ||
"type": "object", | ||
"allOf": [ | ||
{ | ||
"$ref": "../../common/IRpcRequest.schema.json" | ||
} | ||
], | ||
"properties": { | ||
"dsname": { | ||
"type": "string", | ||
"description": "Dataset name to read" | ||
}, | ||
"encoding": { | ||
"type": "string", | ||
"description": "Encoding to use when reading the dataset" | ||
} | ||
}, | ||
"required": [ | ||
"command", | ||
"dsname" | ||
] | ||
} |
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,37 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"title": "Response", | ||
"x-typescript-type": "ReadDataset.Response", | ||
"description": "Response containing dataset contents", | ||
"type": "object", | ||
"allOf": [ | ||
{ | ||
"$ref": "../../common/IRpcResponse.schema.json" | ||
} | ||
], | ||
"properties": { | ||
"data": { | ||
"oneOf": [ | ||
{ | ||
"type": "string" | ||
}, | ||
{ | ||
"type": "object", | ||
"description": "Buffer object containing UTF-8 data" | ||
} | ||
] | ||
}, | ||
"dsname": { | ||
"type": "string", | ||
"description": "Dataset name that was read" | ||
}, | ||
"encoding": { | ||
"type": "string", | ||
"description": "Encoding used when reading the dataset" | ||
} | ||
}, | ||
"required": [ | ||
"data", | ||
"dsname" | ||
] | ||
} |
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,22 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"title": "Request", | ||
"x-typescript-type": "RestoreDataset.Request", | ||
"description": "Request to restore a dataset", | ||
"type": "object", | ||
"allOf": [ | ||
{ | ||
"$ref": "../../common/IRpcRequest.schema.json" | ||
} | ||
], | ||
"properties": { | ||
"dataset": { | ||
"type": "string", | ||
"description": "Dataset name to restore" | ||
} | ||
}, | ||
"required": [ | ||
"command", | ||
"dataset" | ||
] | ||
} |
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,21 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"title": "Response", | ||
"x-typescript-type": "RestoreDataset.Response", | ||
"description": "Response from restoring a dataset", | ||
"type": "object", | ||
"allOf": [ | ||
{ | ||
"$ref": "../../common/IRpcResponse.schema.json" | ||
} | ||
], | ||
"properties": { | ||
"success": { | ||
"type": "boolean", | ||
"description": "Whether the restore operation was successful" | ||
} | ||
}, | ||
"required": [ | ||
"success" | ||
] | ||
} |
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,38 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"title": "Request", | ||
"x-typescript-type": "WriteDataset.Request", | ||
"description": "Request to write contents to a dataset", | ||
"type": "object", | ||
"allOf": [ | ||
{ | ||
"$ref": "../../common/IRpcRequest.schema.json" | ||
} | ||
], | ||
"properties": { | ||
"dsname": { | ||
"type": "string", | ||
"description": "Dataset name to write to" | ||
}, | ||
"contents": { | ||
"oneOf": [ | ||
{ | ||
"type": "string" | ||
}, | ||
{ | ||
"type": "object", | ||
"description": "Buffer object containing UTF-8 data" | ||
} | ||
] | ||
}, | ||
"encoding": { | ||
"type": "string", | ||
"description": "Encoding to use when writing the dataset" | ||
} | ||
}, | ||
"required": [ | ||
"command", | ||
"dsname", | ||
"contents" | ||
] | ||
} |
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,26 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"title": "Response", | ||
"x-typescript-type": "WriteDataset.Response", | ||
"description": "Response from writing to a dataset", | ||
"type": "object", | ||
"allOf": [ | ||
{ | ||
"$ref": "../../common/IRpcResponse.schema.json" | ||
} | ||
], | ||
"properties": { | ||
"dsname": { | ||
"type": "string", | ||
"description": "Dataset name that was written to" | ||
}, | ||
"success": { | ||
"type": "boolean", | ||
"description": "Whether the write operation was successful" | ||
} | ||
}, | ||
"required": [ | ||
"dsname", | ||
"success" | ||
] | ||
} |
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,42 @@ | ||
// This file was generated from JSON Schema using quicktype, do not modify it directly. | ||
// To parse and unparse this JSON data, add this code to your project and do: | ||
// | ||
// iRPCRequest, err := UnmarshalIRPCRequest(bytes) | ||
// bytes, err = iRPCRequest.Marshal() | ||
// | ||
// iRPCResponse, err := UnmarshalIRPCResponse(bytes) | ||
// bytes, err = iRPCResponse.Marshal() | ||
|
||
package doc | ||
|
||
import "encoding/json" | ||
|
||
func UnmarshalIRPCRequest(data []byte) (IRPCRequest, error) { | ||
var r IRPCRequest | ||
err := json.Unmarshal(data, &r) | ||
return r, err | ||
} | ||
|
||
func (r *IRPCRequest) Marshal() ([]byte, error) { | ||
return json.Marshal(r) | ||
} | ||
|
||
func UnmarshalIRPCResponse(data []byte) (IRPCResponse, error) { | ||
var r IRPCResponse | ||
err := json.Unmarshal(data, &r) | ||
return r, err | ||
} | ||
|
||
func (r *IRPCResponse) Marshal() ([]byte, error) { | ||
return json.Marshal(r) | ||
} | ||
|
||
// Interface for RPC request objects | ||
type IRPCRequest struct { | ||
Command string `json:"command"` | ||
} | ||
|
||
// Interface for RPC response objects | ||
type IRPCResponse struct { | ||
Success *bool `json:"success,omitempty"` | ||
} |
Oops, something went wrong.