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

feat: anymaniax#352 support allOf #861

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

yokoyama-takuya
Copy link

@yokoyama-takuya yokoyama-takuya commented May 17, 2023

Status

READY

Fix #352

Description

fix allOf type definition
e.g. #352

Related PRs

#503

Change

before

export type GetPets200PetsItemAllOf = {
  /** required name */
  name?: unknown;
  /** @deprecated */
  owner?: unknown;
};

export type GetPets200PetsItem = Pet & unknown & GetPets200PetsItemAllOf;

export type GetPets200 = {
  pets?: GetPets200PetsItem[];
};

/**
 * default Person description
 */
export interface Person {
  id: string;
  /** default Person name */
  name?: string;
}

export type PetOwnerAllOf = {
  /** required name */
  name?: unknown;
};

export type PetOwner = Person & PetOwnerAllOf;

/**
 * default Pet description
 */
export interface Pet {
  id?: string;
  /** default Pet name */
  name?: string;
  owner: PetOwner;
}

after

/**
 * default Person description
 * @deprecated
 */
export type GetPets200PetsItemOwner = {
  id: string;
  /** required name */
  name: string;
};

/**
 * default Pet description
 */
export type GetPets200PetsItem = {
  id?: string;
  /** required name */
  name: string;
  /**
   * default Person description
   * @deprecated
   */
  owner: GetPets200PetsItemOwner;
};

export type GetPets200 = {
  pets?: GetPets200PetsItem[];
};

/**
 * default Person description
 */
export interface Person {
  id: string;
  /** default Person name */
  name?: string;
}

/**
 * default Person description
 */
export type PetOwner = {
  id: string;
  /** required name */
  name: string;
};

/**
 * default Pet description
 */
export interface Pet {
  id?: string;
  /** default Pet name */
  name?: string;
  /** default Person description */
  owner: PetOwner;
}

@vercel
Copy link

vercel bot commented May 17, 2023

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

@anymaniax first needs to authorize it.

@yokoyama-takuya
Copy link
Author

@anymaniax Resubmitted a fix pull request for allOf. I have rewritten it to a simpler code, so please consider it.

Copy link
Author

@yokoyama-takuya yokoyama-takuya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@anymaniax Thanks for the review. I replied.

packages/core/src/getters/object.ts Outdated Show resolved Hide resolved
packages/core/src/resolvers/object.ts Outdated Show resolved Hide resolved
@anymaniax
Copy link
Owner

I did other test with more complex specification. I got a RangeError: Maximum call stack size exceeded.

@yokoyama-takuya
Copy link
Author

@anymaniax Can I have the Swagger file that I tested here?

@anymaniax
Copy link
Owner

I cannot share it but will try to do a reproduction of the issue

@yokoyama-takuya
Copy link
Author

@anymaniax In specs where the elements of objects and arrays are cyclically referenced, as expected. I wonder if the recursive function never ends. Is that API realistic?

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.

Required field ignored in case of allOf
2 participants