-
-
Notifications
You must be signed in to change notification settings - Fork 347
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(core): distinguish the value when it is blank only in interface
#1228
fix(core): distinguish the value when it is blank only in interface
#1228
Conversation
…ma interface (orval-labs#1219)" This reverts commit 97552e4.
This PR will be on hold until the discussion in #1227 is over. If you are in a hurry to fix the problem, I think this PR will help you. |
@soartec-lab i added my openapi JSON an Orval config in the ticket if you want to verify. |
@@ -46,7 +46,10 @@ export const generateInterface = ({ | |||
scalar.type === 'object' && | |||
!context?.output.override?.useTypeOverInterfaces | |||
) { | |||
model += `export interface ${name} ${scalar.value}\n`; | |||
// If `scalar.value` is 'unknown', replace it with `{}` to avoid type error | |||
const blankIntefaceValue = scalar.value === 'unknown' ? '{}' : scalar.value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const blankIntefaceValue = scalar.value === 'unknown' ? '{}' : scalar.value; | |
const blankInterfaceValue = scalar.value === 'unknown' ? '{}' : scalar.value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed it
// If `scalar.value` is 'unknown', replace it with `{}` to avoid type error | ||
const blankIntefaceValue = scalar.value === 'unknown' ? '{}' : scalar.value; | ||
|
||
model += `export interface ${name} ${blankIntefaceValue}\n`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
model += `export interface ${name} ${blankIntefaceValue}\n`; | |
model += `export interface ${name} ${blankInterfaceValue}\n`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed it
@melloware |
interface
@melloware |
Thanks!! |
Status
READY
Description
fix #1227
When I responded to #1219, it caused unintended destruction, so I revert #1219.
This issue occurs when the doesn't have
type
like a bellow:And, the issue where the interface definition results in an error when interface is an blank schema is resolved by replacing the value only in the case of interfaces.
Related PRs
{}
insterd ofunknown
for blank schema interface #1219Todos
Steps to Test or Reproduce
orval