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

Add support for prefixItems #864

Open
edobrb opened this issue May 2, 2023 · 3 comments
Open

Add support for prefixItems #864

edobrb opened this issue May 2, 2023 · 3 comments

Comments

@edobrb
Copy link

edobrb commented May 2, 2023

From what I understand, OAS 3.1 should support the same validations offered by JSON Schema. It should be possible to define a type { type: 'array', minItems: 2, maxItems: 2, prefixItems: [...] } that would be used to define tuples.

https://json-schema.org/draft/2020-12/json-schema-validation.html

I hope I'm not mistaken, but currently it is not supported in this repository:

export interface ArraySchemaObject extends BaseSchemaObject {
type: ArraySchemaObjectType;
items: ReferenceObject | SchemaObject;
}

@saschahofmann
Copy link

Although I cant find it in this codebase when using the package I can find this now

 interface ArraySchemaObject extends BaseSchemaObject {
        type: ArraySchemaObjectType;
        items: ReferenceObject | SchemaObject;
        prefixItems: ReferenceObject | SchemaObject;
    }

which seems wrong to me? Shouldn't prefixItems be an array? Also not sure how it ends up in my nodeModules like this. I cant find prefixItems mentioned anywhere.

@edobrb
Copy link
Author

edobrb commented Aug 17, 2023

Yes prefixItems should be an array. See TupleSchemaObject in #865

@saschahofmann
Copy link

Yeah I think, I accidentally added the file in node_modules 😏 . After I reinstalled the package it looks like openapi-types doesnt support prefixItems yet.

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