I have the swagger ui embedded in my application. And when I run my node application locally the UI works great.
However when I deploy the UI to my 'real' server I get an error image in the bottom right of my swagger ui:
I am sure this is something I am doing that is screwing it up but I have no idea. Again works locally when I access swagger ui via http.
However when I deploy I run through apache and serve out over https, I see an error. Even worse none of my 'Try it' calls work when deployed. Seems like the request is not being made.
Looks like the UI makes a call to a validator with my swagger.json, however that call works locally.
What am I doing wrong?
When I click the error icon, I get:
To turn off swagger validator add validatorUrl : null, in dist/index.html in
window.swaggerUi = new SwaggerUi({
url: url,
validatorUrl : null,
dom_id: "swagger-ui-container",
When this happens (and it sometimes does) I go here:
http://json-schema-validator.herokuapp.com/index.jsp
Paste the swagger schema from here https://github.com/swagger-api/swagger-spec/blob/master/schemas/v2.0/schema.json in the schema field and then your spec in the data field
Swagger-UI is able to handle some malformed specs, which is probably why it is works locally.
By default, the validation process does not run when the spec is read from localhost. You should be able to run it still, if you wish, using the validatorUrl (https://github.com/swagger-api/swagger-ui#parameters).
To see the validation errors, just click on the ERROR icon, and it will give you a list of problems with your spec.
Related
Following the ODATA V4 tutorial in step 2: app runs against mockserver, tips are given to run it against a real server. Used the existing index.html as test/mockServer.html and created a new index.html, pointing to ComponentSupport for oninit. Added cors-anywhere and adjusted the manifest. Works well, both mockserver and real.
That was in step 2 and the app worked fine also against a real server. Fast-forward to step 5 and I notice the app fails to load any data when running against a real server. Long story short, the backend is throwing an error, not even "count" together with "top" is accepted. I checked the docs for ODATA, "count" does not seem to be an exclusive option.
Am I fundamentally misunderstanding the way ODATA works? I am especially puzzled by the fact that the mockserver runs fine.
EDIT: created bugreport
As reported in the closing comment of my bugreport, Microsoft has confirmed the issue: "This was due to an error in the version of the OData WebAPI library we were using in the backing service. I have an update with various fixes, including updating to the latest WebAPI library that contains this fix, that I just haven't pushed out to production yet. Let me see when if I can get that deployed."
I'm running my Cypress locally and they are always pass, but when I'm running them in jenkins, I keep getting this error:
> Blocked a frame with origin "http://localhost:3000" from accessing a cross-origin frame.
Before the page load, you were bound to the origin policy:
> http://localhost:3000
A cross origin error happens when your application navigates to a new superdomain which does not match the origin policy above.
This typically happens in one of three ways:
1. You clicked an <a> that routed you outside of your application
2. You submitted a form and your server redirected you outside of your application
3. You used a javascript redirect to a page outside of your application
Cypress does not allow you to change superdomains within a single test.
You may need to restructure some of your test code to avoid this problem.
Alternatively you can also disable Chrome Web Security which will turn off this restriction by setting { chromeWebSecurity: false } in your 'cypress.json' file.
https://on.cypress.io/cross-origin-violation
sometimes one of them passes
I tried to add chromeWebSecurity: false to my cypress.json
but got "data:" in my url after logging in the test
(I'm logging out w/ api call that doesn't do a redirect)
Most likely there is some javascript that is calling window.top.location or some other form of redirect. We call this framebusting, when your app busts out of its iframe into the cypress top level frame. Cypress attempts to strip out this framebusting code via a regex but it's possible for code to slip through.
You should either:
find and disable/remove the framebusting javascript
submit an issue with more specifics to the cypress team here
here's some similar issues to yours: https://github.com/cypress-io/cypress/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+framebust
I have installed Swagger UI on my local machine. When I am pulling up some Swagger definitions, the definitions are working fine, however, when I click on the "Try it out!" button, the call fails stating "No response from server".
However, when I take the Request URL from Swagger UI and run it directly in the browser, the server responds (BAU).
Am I missing something? Do I need to setup/configure Swagger UI to make this call happen?
Note: I have just downloaded the latest version of Swagger and running it locally on Windows desktop with Tomcat server.
Please help.
The specs for Swagger-ui is usually in JSON format which contains host(including port), basePath, paths (path array of each API service). Swagger-client will construct the request URL from all these properties and send the request to the URL with an "Accept" header. Now you can not get response from service you need to check whether the backend services are running. You can open browser development tools to capture the HTTP request and see if it is correct.
You can go to http://petstore.swagger.io/ to see how it works.
I have code that looks something like this (_http is the angular Http object)
var httpFuture = _http.post('/api/items', {
'ids': JSON.encode(new List.from(nonLoadedIds))
});
httpFuture.catchError((e) {
Logger.root.severe('Unable to load items!', e);
});
It is making a post request to load a bunch of things. Potentially more ids than the http get header can handle.
The nice development experience would be if I could fire up the dart editor, mock up some fake response data, run my app, and see the data in the end. I would also accept being able to start up a separate web app and somehow proxy my post requests to that web app.
What I don't want to do is change my '/api/items' into something like 'http://localhost:8084/api/items' mostly because I don't want to have to remember to replace these before deploying (I know I'll forget) and while doable, I don't want to on my server implement CORS just to have to remember to disable it when I deploy to production.
But really, I would accept just about any workflow if it is recommended. I just would like to eliminate any manual code transformations pre production deploy.
The suggested attempt is to use a simple proxy server which forwards to pub serve.
See for example https://code.google.com/p/dart/issues/detail?id=18039
This issue contains the source code for a simple custom proxy server example https://code.google.com/p/dart/issues/detail?id=15731
see also
Dart: How to use different settings in debug and production mode?
How to achieve precompiler directive like functionality
Is there a compiler preprocessor in Dart?
There is this one action that is requested using javascript during the loading of a page, it takes over 25 seconds to resolve. Looking at the code makes me think there is a scaling issue, but I am wondering if there is any way I can step through the code during the request so I can see what is happening. I try clicking 'debug/start debugging' but it won't launch the proper URL (access to the site is subdomain based), and it will also not find certain dependencies. I am able to browse the site directly via URL locally after mapping a URL via my hosts file to localhost (127...) but the default url that pops up (localhost...) from debug does not work because it is not formatted properly.
Any ideas?
You can attach the debugger to your browser by selecting "Attach to process" under "Debug" menu.
In the past, at least with ASP.NET we have used tracing to debug issues. You will just need to enable it in the webconfig. If you use warn, the messages will show in red and be easier to spot.