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

Meta className for Schemas using .concat() does not update #121

Closed
adamcharlton opened this issue Jul 2, 2021 · 2 comments
Closed

Meta className for Schemas using .concat() does not update #121

adamcharlton opened this issue Jul 2, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@adamcharlton
Copy link

For version 2.0.1 when using a Joi schema that is created via .concat() and then adding a new className via .meta() the resulting type that is generated does not use the new className.

As an example:

Schema:

import Joi from 'joi';

export const A = Joi.object({
  a: Joi.string()
}).meta({ className: 'A' });

export const B = Joi.object({
  b: Joi.string()
}).meta({ className: 'B' });

export const AB = A
  .concat(B)
  .meta({ className: 'AB' });

What is generated:

/**
 * This file was automatically generated by joi-to-typescript
 * Do not modify this file manually
 */

export interface A {
  a?: string;
  b?: string;
}

export interface A {
  a?: string;
}

export interface B {
  b?: string;
}

What is expected:

/**
 * This file was automatically generated by joi-to-typescript
 * Do not modify this file manually
 */

export interface A {
  a?: string;
}

export interface B {
  b?: string;
}

export interface AB {
  a?: string;
  b?: string;
}
@mrjono1 mrjono1 added the bug Something isn't working label Jul 2, 2021
@mrjono1
Copy link
Owner

mrjono1 commented Jul 2, 2021

#122
This should resolve your issue

@mrjono1
Copy link
Owner

mrjono1 commented Jul 2, 2021

@mrjono1 mrjono1 closed this as completed Jul 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants