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

swagger-ui-bundle.js:58880 Could not find component #2931

Closed
mgeorgy opened this issue Apr 19, 2017 · 10 comments
Closed

swagger-ui-bundle.js:58880 Could not find component #2931

mgeorgy opened this issue Apr 19, 2017 · 10 comments

Comments

@mgeorgy
Copy link

mgeorgy commented Apr 19, 2017

Swagger-ui loads without issue, however when attempting to use the 'Try it out' feature I'm noticing several warnings within the swagger-ui-bundle.js. Is this known/expected behavior?

The general errors are:
swagger-ui-bundle.js:58880 Could not find component JsonSchema_string_
swagger-ui-bundle.js:58880 Could not find component JsonSchema_integer_
swagger-ui-bundle.js:58880 Could not find component JsonSchema_integer
swagger-ui-bundle.js:58880 Could not find component JsonSchema_string_boolean
swagger-ui-bundle.js:58880 Could not find component JsonSchema_string_full-date

@fehguy
Copy link
Contributor

fehguy commented Apr 19, 2017

Are you running from the project directory or have you brought swagger-ui-bundle.js into your own project? If so, can you please share how you did it?

@mgeorgy
Copy link
Author

mgeorgy commented Apr 19, 2017

I'm running out of the dist directory.

DocumentRoot /var/www/swagger-ui/dist

@fehguy
Copy link
Contributor

fehguy commented Apr 19, 2017

eh, that's not the project directory. I have a feeling you're missing some files in there.

@mgeorgy
Copy link
Author

mgeorgy commented Apr 19, 2017

Any suggestions on resolving this? I cloned the project to this directory. What files do you think I might be missing?

@shockey
Copy link
Contributor

shockey commented Apr 19, 2017

These warnings are nothing to be worried about 😄

In the json schema rendering code, we optimistically query our system for a number of components. If the component doesn't exist, those warnings get thrown.

As long as you're not seeing render errors accompanying those warnings, you should be good to go.

@fehguy, if we want to silence these errors, we can modify this code to query for the component before attempting to get a reference to the component.

@mgeorgy
Copy link
Author

mgeorgy commented Apr 19, 2017

Thank you!

@mgeorgy mgeorgy closed this as completed Apr 19, 2017
@Download
Copy link

If it really is nothing to be worried about, it would probably be best to silence the warning. People will worry about it and google the warning and find this issue and add a comment here... Like I'm doing right now. 😄

@glad4enkonm
Copy link

Hi, it looks like I faced this issue. Could you have a look?
My api responds with int64 number and I can not retrieve instance by this id later,
because value in UI is rounded (4 errors in console are the correct respond from the api ).

image

@Download
Copy link

Download commented Dec 9, 2017

My api responds with int64 number

Does it actually use all those 64 bits?

It is important to understand that Javascript does not have Integer and Float. Instead, it only has Number, which is a 64-bit floating point format. The integer numbers are encoded as 64 bit floats. This means you can only safely store int's that fit in 53 bits.

Check out Number.MIN_SAFE_INTEGER and Number.MAX_SAFE_INTEGER... Only ints that fall in this range are 'safe' to be encoded using Number.

If you need support for larger numbers, the way to do that is by using a custom library, such as big-number. It is a very similar situation to say using 128 bit numbers in Java... It can't be done natively, you need a support library. In JS this happens for integers bigger than 53 bits or floats bigger than 64 bits.

A simple solution might be to encode the ID as a string.

EDIT: Should have looked at your screenshot better. The number shown is too big to fit in a JS Number. Either safe it as a string, or use some big number library.

@glad4enkonm
Copy link

Thanks, Download, for your explanation!

@lock lock bot locked and limited conversation to collaborators Jul 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants