-
Notifications
You must be signed in to change notification settings - Fork 9k
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: Invariant Violation: Minified React error #37; visit http://facebook.github.io/react/docs/error-decoder.html?invariant=37 #3955
Comments
Hmm, this is weird. At first look, your component seems good. Is it working when you actually view the application in your browser, or is it broken entirely? Just asking because you only mentioned your test failing. Also, just an fyi - you should consider using |
Yes it is working I created #3955 for reporting test failing on latest react/enzyme/jest versions and #3947 for support because my OAuth authentication process is incomplete with the implementation I shared here. I have read the documentation and all the related OAuth2 implementation issues. I have swaggerui initialized on my screen: I am using the
I am using webpack. I have understood that dist was for people who aren't willing to edit the sources code and |
Hi @kopax, sorry for the delay here. I think this is due to you using the Can you try using the Full DOM Rendering interface that Enzyme exposes, in this test? Docs here: http://airbnb.io/enzyme/docs/api/mount.html Let me know where that gets you. |
@shockey it does the same
|
I'm seeing a similar error - and it seems to be cause by Swagger-UI including a dependency of React 15 (Rather than a peer dependency) Still searching for a solution... |
@silver2k, please see #3714, #3970 and most importantly #3934 for more context and information on React 16 usage and the The short answer: I don't see a way to move react to peerDependencies without seriously complicating the situation for non-React consumers of |
@shockey Thanks for the quick feedback. I wasn't suggesting you move to using a peerDependency - and I imagine splitting swagger-ui into frontend & lib modules is non-trivial. |
A possible way forward on this: create a It would have to live in Swagger-UI core, having |
I am also suffering from this error. Has anyone come up with a solution or a work-around yet? |
Fixed! We've just released |
@shockey thanks a lot for solving this. There is still one unresolved question that I'd like to get an answer. (Otherwise we cannot use swagger UI with our spring boot application)
We have secured endpoints with OAuth2, we need to authenticate using OAuth2 |
@kopax, we don't currently have a documented way to do this with |
Sure no problem @shockey and thank you. I hang still 2017, OAuth authorization strategies exist since the OAuth2 specification. I tried swagger UI and even if I couldn't authenticate I really liked what I saw, the wait is justified, could you please post the link to the next issue so I can follow. |
Hi i keep getting this error on a OSGI project where i put my swagger-ui (dist) resource . <!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Swagger UI</title>
<script src="./jquery-external/requirejs/require.js"></script>
<script src="./jquery-dist/jquery.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="./swagger-ui-dist/swagger-ui.css" >
<link rel="icon" type="image/png" href="./swagger-ui-dist/favicon-32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="./swagger-ui-dist/favicon-16x16.png" sizes="16x16" />
<style>
html
{
box-sizing: border-box;
overflow: -moz-scrollbars-vertical;
overflow-y: scroll;
}
*,
*:before,
*:after
{
box-sizing: inherit;
}
body
{
margin:0;
background: #fafafa;
}
</style>
</head>
<body class="swagger-section">
<div id="header">
<div class="swagger-ui-wrap">
<a id="logo" href="http://swagger.io">swagger</a>
<form id="api_selector">
<div class="input"><input placeholder="http://example.com/api" id="input_baseUrl" name="baseUrl" type="text"/></div>
<div class="input"><input placeholder="api_key" id="input_apiKey" name="apiKey" type="text"/></div>
<div class="input"><a id="explore" href="#" data-sw-translate>Explore</a></div>
</form>
</div>
</div>
<div id="message-bar" class="swagger-ui-wrap" data-sw-translate> </div>
<div id="swagger-ui-container" class="swagger-ui-wrap"></div>
<script src="./swagger-ui-dist/swagger-ui-bundle.js"> </script>
<script src="./swagger-ui-dist/swagger-ui-standalone-preset.js"> </script>
<script type="text/javascript">
window.onload = function() {
var url = window.location.search.match(/url=([^&]+)/);
if (url && url.length > 1) {
url = decodeURIComponent(url[1]);
} else {
url = "/cxf/swagger/swagger.json";
}
// Pre load translate...
if(window.SwaggerTranslator) {
window.SwaggerTranslator.translate();
}
window.swaggerUi = new SwaggerUIBundle({
url: url,
dom_id: "swagger-ui-container",
deepLinking: true,
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
layout: "StandaloneLayout",
supportedSubmitMethods: ["get", "post", "put", "delete", "patch"],
onComplete: function(swaggerApi, swaggerUi){
if(typeof initOAuth == "function") {
initOAuth({
clientId: "your-client-id",
clientSecret: "your-client-secret",
realm: "your-realms",
appName: "your-app-name",
scopeSeparator: ","
});
}
if(window.SwaggerTranslator) {
window.SwaggerTranslator.translate();
}
$("pre code").each(function(i, e) {
hljs.highlightBlock(e)
});
addApiKeyAuthorization();
},
onFailure: function(data) {
log("Unable to Load SwaggerUI");
},
docExpansion: "none",
apisSorter: "alpha",
showRequestHeaders: false
});
function addApiKeyAuthorization(){
var key = encodeURIComponent($("#input_apiKey")[0].value);
if(key && key.trim() != "") {
var apiKeyAuth = new SwaggerClient.ApiKeyAuthorization("api_key", key, "query");
window.swaggerUi.api.clientAuthorizations.add("api_key", apiKeyAuth);
log("added key " + key);
}
}
$("#input_apiKey").change(addApiKeyAuthorization);
window.swaggerUi.load();
function log() {
if ("console" in window) {
console.log.apply(console, arguments);
}
}
}
</script>
</body>
</html>
|
@p4535992 please open a new issue following the issue template. |
With the latest swagger-ui version, I have written the following test in my react 16 application using jest and enzyme v3 and catched the following error:
This is the tested page
expected
test to pass:
result
error :
The text was updated successfully, but these errors were encountered: