Skip to content

error: SyntaxError: '=>' expected as a result of empty oneOfs #810

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

Closed
deannashih opened this issue Nov 29, 2021 · 3 comments
Closed

error: SyntaxError: '=>' expected as a result of empty oneOfs #810

deannashih opened this issue Nov 29, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@deannashih
Copy link

deannashih commented Nov 29, 2021

Hi! Looks like any field with an empty oneOf is causing the script to error out with a syntax error:
error: SyntaxError: '=>' expected

In my specific case, it's

SyntaxError: '=>' expected. (237:16)
  235 |
  236 | };
> 237 | "MetaQuote": ();

In the input file, MetaQuote is defined as:

MetaQuote:
      oneOf: []
      discriminator:
        propertyName: meta_serialization_key
        mapping: {}

Only after I removed all fields with an empty oneOf did the script stop erroring out.

It may be similar to #561, where the fix was made for empty enums.

@sadfsdfdsa
Copy link
Contributor

sadfsdfdsa commented Dec 15, 2021

Start working on it.
So what's the expected result of oneOf: [] and allOf: []?
Is it undefined, @deannashih?

Also it's can be any or unknown, but I prefer undefined for stronger typing.

Got this result:

image

UPD: #830

@drwpow drwpow added the bug Something isn't working label Jan 11, 2022
@madisonbullard
Copy link

@drwpow @sadfsdfdsa Looks like this issue re-emerged in v5.2.0. Was working in 5.1.0.

@mitchell-merry
Copy link
Contributor

I believe this was fixed in #1069 for version 6. Previously, this schema generated like so:

MetaQuote: ;

but now generates as:

MetaQuote: never;

Comment here if different behavior is desired.

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

5 participants