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

fix: additional properties of the objects should have any type #190

Merged
merged 1 commit into from Aug 2, 2021

Conversation

HosseinAgha
Copy link
Contributor

@HosseinAgha HosseinAgha commented Jul 31, 2021

Status

READY

Description

Setting each property of an object with additionalProperties: true to have object type is wrong. It enforces all other properties to have the object type.
I've changed it to any.

{
  type: 'object'
  properties: {
    foo: string;
  }
  additionalProperties: true;
}

For the above schema output would be.

before

interface ObjectWithAdditionalProps {
  foo: string; // typescript error: Property 'foo' of type 'string' is not assignable to string index type 'object'
  [key: string]: object;
}

after

I used any as there is no way to predict what types would a user use in their additional properties.

interface ObjectWithAdditionalProps {
  foo: string;
  [key: string]: any;
}

@anymaniax

Todos

  • Tests
  • Documentation
  • Changelog Entry (unreleased)

BREAKING CHANGE: the objects with additional properties now have a different file
@vercel
Copy link

vercel bot commented Jul 31, 2021

Someone is attempting to deploy a commit to a Personal Account owned by @anymaniax on Vercel.

@anymaniax first needs to authorize it.

@anymaniax anymaniax merged commit c933ae1 into anymaniax:master Aug 2, 2021
@anymaniax
Copy link
Owner

Thanks 🎉

antoni pushed a commit to mbank-design/orval that referenced this pull request Aug 24, 2021
…niax#190)

BREAKING CHANGE: the objects with additional properties now have a different file
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

Successfully merging this pull request may close these issues.

None yet

2 participants