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

Data validation: validate Array of objects have a specific structure #288

Open
humitos opened this issue Apr 10, 2024 · 0 comments
Open
Labels
Improvement Minor improvement to code

Comments

@humitos
Copy link
Member

humitos commented Apr 10, 2024

I found myself want to validate the object items included into an Array. However, I didn't find a quick way to do it while working on #281 so I wrote a TODO comment there.

A small example of what I want is on the versions.active field:

    versions: {
      type: "object",
      required: ["current", "active"],
      properties: {
        active: {
          type: "array",
          // TODO: validate each item of the array has the following structure
          //
          // items: { type: "object" },
          // required: ["slug", "urls"],
          // properties: {
          //   slug: { type: "string" },
          //   urls: {
          //     type: "object",
          //     required: ["documentation"],
          //     properties: {
          //       documentation: { type: "string" },
          //     },
          //   },
          // },
        },
@humitos humitos added the Improvement Minor improvement to code label Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Improvement Minor improvement to code
Projects
None yet
Development

No branches or pull requests

1 participant