Closed pedrouid closed 3 years ago
Welcome to OpenRPC! Thank you for taking the time to create an issue. Please review the guidelines
Hi @pedrouid,
In the spec params
is always an array. If you want configure object (by-name
) vs array (by-position
) parameter request formatting check out paramStructure
on Method Object.
Params is not a JSON-Schema, but an array of Content Descriptor Objects which includes fields like name
(required), description
, schema
(required)(which is a JSON-Schema) etc.
Here is an example:
{
"openrpc": "1.0.0",
"info": {
"version": "1.0.0",
"title": "Petstore"
},
"methods": [
{
"name": "create_pet",
"summary": "Create a pet",
"paramStructure": "by-name",
"params": [
{
"name": "newPetName",
"description": "Name of pet to create",
"schema": {
"type": "string"
}
},
{
"name": "newPetTag",
"description": "Pet tag to create",
"schema": {
"type": "string"
}
}
],
"result": {
"name": "petId",
"schema": {
"type": "integer",
"minimum": 0
}
}
}
]
}
Awesome 🙌 Thanks for taking the time to clarify that. It makes more sense now!
I've just learned about OpenRPC and I think this is an amazing project that should be far more adopted.
However it seems from the examples on the website that the specification for the
params
for methods assumes that they are always an array.I would expect the params to be specified as per json-schema specification:
Am I interpreting this correctly?