Authress-Engineering / openapi-explorer

OpenAPI Web component to generate a UI from the spec.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JS error on page reload

neongrau opened this issue · comments

Since about a week (maybe two) i'm seeing Uncaught (in promise) TypeError: l[n] is null errors when re-loading any deep link.

This prevents the Schema from being rendered (page ends at curl example). When clicking a menu link for any other endpoint and back to the previous everything will render again correctly.

Can you provide a minimal spec that reproduces the problem? And I'm not totally sure what "re-loading a deep link" means, what are the reproduction steps for the problem?

Navigate to an endpoint. Scroll down to see Schema. Reload page in browser. Scroll down... no Schema shown. See JS errors.

Spec please.

And for clarity, you are able to reproduce this same problem with our public tester?

Broken Spec example:

curl 'https://dev.samedis.care/api-docs/v4/public.yaml' \
  -H 'authority: dev.samedis.care' \
  -H 'accept: */*' \
  -H 'accept-language: en-US,en;q=0.8' \
  -H 'cache-control: no-cache' \
  -H 'pragma: no-cache' \
  -H 'referer: https://dev.samedis.care/api-docs/v4/public/index.html' \
  -H 'sec-ch-ua: "Not A(Brand";v="99", "Brave";v="121", "Chromium";v="121"' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'sec-ch-ua-platform: "Linux"' \
  -H 'sec-fetch-dest: empty' \
  -H 'sec-fetch-mode: cors' \
  -H 'sec-fetch-site: same-origin' \
  -H 'sec-gpc: 1' \
  -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36'

The problem here is your spec is broken. it just list links: but doesn't include a type or schema here. The best bet is to define what links are in your spec. But we'll add some extra validation so that even specs with problems here won't cause an issue.

Broken Spec example:

The problem here is your spec is broken. it just list links: but doesn't include a type or schema here. The best bet is to define what links are in your spec. But we'll add some extra validation so that even specs with problems here won't cause an issue.

Which validator are you using? The one at https://editor-next.swagger.io/ doesn't show any issues. And all i need to do is click another link and then the previous to have it render without error, Happens just on browser reload.

Their parser is broken, it doesn't even show the links as a property in the spec, even though you specified it in the spec.

In the OpenAPI Explorer, you will now see this once the latest version is merged:
image

As far as the validator, we use the openapi-resolver package, I have no idea what they are doing.