rapi-doc / RapiDoc

RapiDoc -WebComponent for OpenAPI Spec
https://rapidocweb.com
MIT License
1.71k stars 285 forks source link

Rapidoc should not show default header for spec failures, when header is set to be hidden and error message contain the details #942

Closed sberwal closed 2 months ago

sberwal commented 1 year ago

Hi

Currently if rapidoc is used in embedded mode and is not able to parse the json specified in the spec-url it shows the default rapidoc header with the name of json file revealed and a default error message saying spec not loaded.

If there was way to handle the error messages thrown by rapidoc and pass a custom error message there for default errors. Also the default rapidoc header should not be revealed.

the rapidoc code

  | <rapi-doc id="thedoc"
  | spec-url="../xyz/swagger/v1/swagger.json"
  | theme = 'light'
  | schema-style = 'table'
  | render-style = 'read'
  | font-size= 'default'
  | show-header = 'false'
  | show-info = 'true'
  | allow-authentication ='false'
  | allow-server-selection = 'false'
  | allow-api-list-style-selection ='false'
  | use-path-in-nav-bar='false'
  | >
  | </rapi-doc>

image

mrin9 commented 1 year ago

thats coz, when it fails to load , it would like to show the path that you provided that resulted in the failure, and allow you to fix and retry again

sberwal commented 1 year ago

I agree with that and the error messages contains the path to the spec which failed to load. Why do we need to show the header again when its set to be hidden?

The header should only be shown for parsing errors when its set to true else error message should be enough to show the path to the failed spec.

Does this make sense?

mrin9 commented 1 year ago

Why do we need to show the header again when its set to be hidden

so that you can fix the path and reload the spec with the hidden header

is it creating any issue on your end ?

sberwal commented 1 year ago

hi mrinmoy,

yes, it creating an issue because we have embedded the rapidoc in html pages customised to our theme. so if any error message comes the rapidoc shows the default header which breaks the GUI as we have set "show-header = false".

Though we understand the path to spec needs to be shown but that spec path is visible in the error message generated by rapidoc below the header. Please see the pic below. The error messages contains the path to the spec so header can still be hidden if its set to be hidden.

253742056-2bd26d7b-077a-4a43-877e-7ee471cce527 1

This will solve the purpose

Thanks, Suraj

sberwal commented 1 year ago

@mrin9 any thoughts on this particular issue.