swagger UI displays "ERROR" and complain about schemaValidationMessages - swagger

for me Swagger works absolutely fine but at the end of the web page "Error" button displays.
On click "Error" button it displays
{
"schemaValidationMessages": []
}
Could you suggest me how can I avoid "Error" button and make it to "Valid" button ?

Related

Rails show flash message before controller action / loading info

What I want to do is actually very simple but i don't know how to achieve it.
The user can enter information and click on "bulk create" and create multiple objects. when finished, the user sees a flash message saying "Saved successfully". But the saving can sometimes take a bit longer, so I also want to show a message saying "Saving..." so the user knows something happens.
It should go like this:
user enters information
user clicks on create button
flash saying "Saving data..." appears
Controller finished and new flash appears that says "Saved successfully" (or "couldn't save etc." when it failed)
I have 1, 2, and 4, but I don't know how to achieve 3 since there is no redirect or something like that... Can I trigger a flash via javascript maybe? Or do I have to do something completely different?
What i propose is creating a div element in your view and placing it where your want your alert to appear. When button is clicked make AJAX post request:
$(".button").click(function () {
$("#alert_div").innerHTML = "Saving";
$.ajax({
url: '/form_submit',
type: 'POST',
data: formData,
success: function(){
$("#alert_div").innerHTML = "Saved successfully";
},
error: function(){
$("#alert_div").innerHTML = "Something went wrong!";
}
});
});

if user change url in browser and request was Invalid stay in current page in yii2

I want to prevent from IDOR attack in yii2.
If user change url in browser and request was Invalid stay in current page.
I use below code .I stay the current page and dot render page with id manipulate after change Id by firebug in link page.
But if I change id in browser I redirected to home page.
for example, the user(by Yii::$app->user->identity->id that is 19) is on this page : url http://localhost:8080/profile/test/19 and see own profile. if user change url to http://localhost:8080/profile/test/25 in browser and press enter , see the same page again http://localhost:8080/profile/test/19 That is, his profile but I go to home page, I think Yii::$app->request->referrer in empty in this case.
public function actionTest($id) {
if (Yii::$app->user->identity->id == $id) {
return $this->render('view', [
'model' => User::findOne($id),
]);
} else {
$this->goBack(Yii::$app->request->referrer);
}
}

ionic2 set cache view when triggering the button

<button class="alt-button" ion-item detail-none (click)="goToAbout()" clear small >
<ion-icon name='person' item-left></ion-icon>About us</button>
Button action
goToAbout() {
this.menu.close();
// close the menu and Goto About page
this.app.getRootNav().push(AboutPage);
}
api call
ionViewDidLoad(){
this.loading.present();
this.aboutservice.getPost().then(
response => {
this.items = response
this.loading.dismiss();
},
error=>{
this.error = error
this.showError('There was problem with server');
this.loading.dismiss();
});
}
it loads the api data everytime,but I want to load api data once and same button action i have used for sidemenu,Its working fine.please give any idea.
It seems strange behavior according to the doc here.
ionViewDidLoad
Runs when the page has loaded. This event only happens once per page
being created. If a page leaves but is cached, then this event will
not fire again on a subsequent viewing. The ionViewDidLoad event is
good place to put your setup code for the page.
But you can use it inside the constructor() as shown below.
constructor() {
//your Api call here
}

Auth pop up returning blank page

When I submit an auth call to google to I get the popup from the google window, then when I submit my credentials and press submit it forwards on to something like
https://auth.firebase.com/v2/FIREBASEREF/auth/google/callback?state= etc
And then all I get is a blank (blue background) screen.
$('#loginButton').click(function() {
myFirebaseRef.authWithOAuthPopup("google", function(error, authData) {
if (error) {
console.log("Login Failed!", error);
alert("Login Failed, please try again.")
} else {
console.log("Authenticated successfully with payload:", authData);
myUserID = authData.uid;
}
});
});
The same is also happening when trying to auth with Github, I can press "submit" or "login" etc. and then it just loads a blank page at auth.firebase.com
Any ideas?
Thanks
FWIW if anyone ends up on this issue: I was getting the exact same thing... the oauth popup was blank and not doing anything. I fixed it by removing the async/await from my form handler:
<form onSubmit={this.onSubmit}>
<button type="submit">Sign In with Google</button>
</form>
...
onSubmit = async event => {
await this.auth.signInWithPopup(this.googleProvider)
.then(....
Sometimes this should be an permissions issue related with the domain where you're trying to do the request like localhost or 127.0.0.1.
In that case, Go to Firebase Console -> Authentication -> Sign-In Method then scroll down to Authorized domains and add your current domain from you're trying to sign in e.g. 127.0.0.1.
Note: This is just for dev purposes, in case you want to deploy your app to Prod, you shouldn't have this configuration. For multiples environments you should check here
Another Note: If you're working with Javascript, you might add an event.preventDefault() before to call firebase.authWithOAuthPopup(...) to be able to obtain the result of the promise that return the authWithOAuthPopup function.
My solution was adding inAppBrowser from cordova and it no longer returned blank page.

Login again on pressing browser back button even after logout successfully

Whenever i press browser back button,it takes me to application's home page without any data even after successfully logout.This only shows page header part and on pressing any menu option brings me back to login page.
I am using Grails-2.3.6 along with JDK-6.
So any body can suggest me what could be the problem as i am new on grails ?
Is a common problem in web development, the page is cached in the browser, so when you press the back button, the browser show what is in his cache. In order to solve this you need to set the expires headers in your pages. In grails the easiest way of do that is using filters:
Create the fie grails-app/conf/RequestFilters.groovy with this content:
class RequestFilters {
def filters = {
requestHeadersFilter(controller: '*', action: '*') {
after = {
response.setHeader("Pragma", "no-cache")
response.setDateHeader("Expires", 1L)
response.setHeader("Cache-Control", "no-cache")
response.addHeader("Cache-Control", "no-store")
}
}
}
}
For safari you will need another small hack, add onunload="" to the body of your layouts (views/layouts)

Resources