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

Its Not validating Objects under an array #145

Open
kamarajuPrathi opened this issue Aug 24, 2017 · 5 comments
Open

Its Not validating Objects under an array #145

kamarajuPrathi opened this issue Aug 24, 2017 · 5 comments

Comments

@kamarajuPrathi
Copy link

if i have an array of objects and object has certains properties , this library is not validation the objects under the array

@LinusU
Copy link
Collaborator

LinusU commented Aug 24, 2017

Could you please post your data, your schema, and how you use the code so that we can reproduce this...

@kamarajuPrathi
Copy link
Author

kamarajuPrathi commented Aug 24, 2017

For example if i have something in my schema as before

  "examples": {
    "type": "array",
    "items": { "$ref": "#/definitions/example" }
  },
  "definitions": {
    "example": {
      "type": "object",
      "properties": {
        "exampleId": { "type": "integer" },
        "solutions": { "$ref": "#/definitions/solutions" }
      }
    },
       "solutions": {
      "type": "array",
      "items": { "$ref": "#/definitions/solution" }
    },
    "solution": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "testName": {"type": "string"},
        "solutionId": { "type": "string" },
        "base": { "type": "number" },
        "baseUOM": { "type": "string" },
      },
      "required": [
        "base",
        "baseUOM"
      ],
      "oneOf": [
        {
          "type": "string",
          "required": [
            "testName"
          ]
        },
        {
          "type": "string",
          "required": [
            "solutionId"
          ]
        }
      ]
    }
  }

Below when give the json as

{
    "examples": [{
        "exampleId": 405666,
        "solutions": [{
            "base": 20,
            "baseUOM": "test"
        }]
    }]
}

it doesnt validation my TestName and solutionId , as oneof them is required

@kamarajuPrathi
Copy link
Author

Basically , is unable to validate ref under definitions , is there a way to specify them to be validated

@LinusU
Copy link
Collaborator

LinusU commented Aug 25, 2017

Hmm, I haven't used $ref that much myself and I'm not too familiar with the code base on that 🤔 I will have to look closer on this...

@ssrballin
Copy link

Are there any updates on this issue? I'm unable to validate simple objects within an array.. 😕

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

3 participants