I am encountering an error in swagger hub that is particularly annoying and seems to occur haphazardly. This issue seemed to be resolved in the past however it is appearing for me in SwaggerHub. The error Cannot Read Property '1' of undefined explodes and makes swagger hub unusable until refreshed.
Example Swagger/OpenAPI definition:
openapi: 3.0.0
components:
schemas:
QuestionBase:
type: object
properties:
question:
type: string
type:
type: string
options:
type: object
QuestionInputBase:
allOf:
- $ref: '#/components/schemas/QuestionBase'
- type: object
required:
- type
QuestionInputById:
allOf:
- $ref: '#/components/schemas/QuestionInputBase'
- type: object
required:
- id
properties:
id:
type: integer
QuestionInputWithOrder:
allOf:
- $ref: '#/components/schemas/QuestionInputBase'
- type: object
required:
- order
- type
properties:
order:
type: integer
minimum: 1
QuestionInputWithOrderById:
allOf:
- $ref: '#/components/schemas/QuestionInputWithOrder'
- type: object
required:
- id
properties:
id:
type: integer
minimum: 1
QuestionInputWithNested:
allOf:
- $ref: '#/components/schemas/QuestionInputBase'
- type: object
required:
- type
properties:
type:
type: string
example: "ranking"
subQuestions:
type: array
items:
oneOf:
- $ref: '#/components/schemas/QuestionInputById'
- $ref: '#/components/schemas/QuestionInputWithOrder'
- $ref: '#/components/schemas/QuestionInputWithOrderById'
Cannot read property '1' of undefined occurring whenever QuestionInputWithNested is expanded in the UI.
Steps to reproduce the behavior:


These seems to happen because QuestionInputWithOrderById is referencing QuestionInputById as part of an allOf. When QuestionInputWithOrderById is removed from the oneOf list of the subQuestions property on the QuestionInputWithNested the issue seems to be fixed. This is strange to me because I am using the same pattern elsewhere and it doesn't cause the same error. I will get around this for now by removing the inheritance which for some reason or another is causing these circular import errors :(
Hmmmm, yeah I see this too.
Good timing @Moro-Code, I'm looking at a similar internal report today, might be related.
Ohh goody!
Was pulling my hair out trying to figure out what was wrong this weekend lol.
Thanks for taking a look
Update:
This behavior was limited to some schemas. I don't know what happened this morning but it has spread such that all schema's now experience this behavior when referencing a schema that it has inherited in an array property for example.
The error's explode and literally crash the tool until refreshed.

This makes inheritance completely unusable for me while using swagger hub
@Moro-Code, just FYI: you'll generally get quicker support from SwaggerHub directly than here, though in this case filing a ticket here is helpful!
I encourage you to open a dialogue with SwaggerHub about this 馃槃
Thanks Shockey will do. I see that the issue has been resolved in swagger ui in general. Do you think its a case that they are not on the latest version?
@Moro-Code, most likely, they're currently on v3.22.3 according to their changelog -- but it could also be the case that they're modifying the stock behavior of the UI, or doing more resolution on their end that is causing the errors.
Hi,
is there any update on this issue? I have an API definition in openapi v3 and face the same issue. I checked with the example from @Moro-Code above and I get the same error with the react component.
Yup, this still exists and is still causing a problem for us.
I'd also like to confirm that this issue still exists.
Ultimately it still lets me generate the code I'm using for it, but it does make adding to the schema a pain since these errors can sometimes block other errors we care about.
Are there any updates on this? Seems I have the same issue here.
Are there any updates on this? Seems I have the same issue here.
I still have the issue. I actually ended up removing my paths from Swagger entirely and saving them somewhere else, as the nature of my project requires just models at the moment. I will need to build the API back eventually.
I did manage to fix this once, by clearing the project then adding each 1 back in, one at a time. The issue disappeared then until I added another definition - then it exploded in exactly the same way.
If we don't know what is causing this, It would be useful in the short term if the error included something like a line-number.
Hey, all perhaps we can band together and fix this ourselves? Looks like it won't be resolved for sometime otherwise
Hi Moro-Code,
have you got an idea how to start? I tried to look in the code and found it quite hard to understand, what's going on overall. I am doing this for work in the company I work for and there is no time for that. But maybe I would have a look at this in the evenings when I had some starting point and orientation.
Yeah no idea where to start. I'll take a look later tonight ( I live in EST timezone ) and I'll come back with my findings. @shockey could you point us in the right direction if we wanted to look at contributing on where we should start ?
Has there been any progress on finding a solution/workaround for this issue?
Could someone please update if any solution for this issue
@Moro-Code I spent a while trying to figure out why I wasn't seeing the problem in the online swagger editor, and the answer is that the currently deployed version per the changelog (0.30.x) does not seem to render resolver errors.
Should be solved by https://github.com/swagger-api/swagger-js/pull/1783
Most helpful comment
Hi,
is there any update on this issue? I have an API definition in openapi v3 and face the same issue. I checked with the example from @Moro-Code above and I get the same error with the react component.