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

Enum schemas not found by compiler #242

Open
benrudhart opened this issue Apr 17, 2020 · 1 comment
Open

Enum schemas not found by compiler #242

benrudhart opened this issue Apr 17, 2020 · 1 comment

Comments

@benrudhart
Copy link

Hi @yonaskolb,
I'm having trouble with enums situated at root level: Supposed we have a (simplified) scheme like this:

---
openapi: 3.0.3
info:
  version: 1.0.0
  title: Test
components:
  schemas:
    Category:
      type: string
      enum:
      - first
      - second

It defines the enum Category which should be available in the API framework.

It is usable if I import it via import enum API.Category, and can simply be used as API.Category.first.
In this case I have to specify the namespace (API) since Foundation is already declaring another Category.

But if the same file needs other objects from API I'd simply like to use import API. If I do so some code like API.Category.first doesn't compile anymore:
Type 'API' has no member 'Category'

I've looked for similar issues here but couldn't find it. I also noticed that this is true for all enum schemas that are situated in the "root" level of API. Most often it's probably not a problem since there's no ambiguity and API names isn't required. In those cases it's fine.

Do you know what causes this issue and how I can fix it?

Don't hesitate contacting me if you need further details.
Best,
Ben

@benrudhart benrudhart changed the title Enum schemas not found by compile Enum schemas not found by compiler Apr 17, 2020
@benrudhart
Copy link
Author

This seems to be related to #159

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

No branches or pull requests

1 participant