Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Json Schema: How to get a [string] result? #4741

Closed
rushairer opened this issue Oct 26, 2022 · 1 comment
Closed

Json Schema: How to get a [string] result? #4741

rushairer opened this issue Oct 26, 2022 · 1 comment

Comments

@rushairer
Copy link

API return : ["abc", "def"]

json-schemas.json

{
    "definitions": {
        "Test": {
            "type": "array",
            "title": "Test",
            "description": "Test Object",
            "items": {
                "type": "string"
            }
        }
    }
}

.meshrc.yaml

- name: TestApi
      handler:
          jsonSchema:
              baseUrl: http://api-host
              operations:
                  - type: Query
                    field: getTest
                    path: /test
                    method: GET
                    responseSchema: ./json-schemas.json#/definitions/Test
query test {
    getTest
}

I got error like:

{
"errors": [
{
"message": "String cannot represent value: { 0: "x", 1: "2", 2: "3", 3: "-", 4: "3", $url: "http://.....", $method: "GET", $request: { query: [Object], path: [Object], header: {} }, $response: { url: "http://......", method: "GET", status: 200, statusText: "OK", body: "x23-3" } }",
"path": [
"didManufacturerList",
0
]
},
{
.....
}
],
"data": {
"getTest": [
null,
null
]
}
}

@theguild-bot theguild-bot mentioned this issue Nov 10, 2022
ardatan added a commit that referenced this issue Mar 31, 2023
@ardatan
Copy link
Owner

ardatan commented Mar 31, 2023

Seems to be working fine in the latest version;
7cb909b

@ardatan ardatan closed this as completed Mar 31, 2023
@theguild-bot theguild-bot mentioned this issue Sep 28, 2023
This was referenced Apr 30, 2024
This was referenced May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants