You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
benrudhart
changed the title
Enum schemas not found by compile
Enum schemas not found by compiler
Apr 17, 2020
Hi @yonaskolb,
I'm having trouble with enums situated at root level: Supposed we have a (simplified) scheme like this:
It defines the enum
Category
which should be available in theAPI
framework.It is usable if I import it via
import enum API.Category
, and can simply be used asAPI.Category.first
.In this case I have to specify the namespace (
API
) sinceFoundation
is already declaring anotherCategory
.But if the same file needs other objects from
API
I'd simply like to useimport API
. If I do so some code likeAPI.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 andAPI
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
The text was updated successfully, but these errors were encountered: