Invalid schema for REST JSON CreatePassengerNameRecord response - sabre

I am trying to test the integration for the Sabre CreatePassengerNameRecord rest API. As the first step, I tried downloading the JSON schemas for the Request and Response and tried to generate the POJOs using jsonschema2pojo. But it looks like the schema files are all pointing to dependent references using a URL http://services.sabre.com which is non existing. Hence the POJO generation is getting failed. This is happening for both the request and response. I was able to fix the request schema by changing the URL for XMLSchemaTypes.json dependency to provided URL link in documentation, but the response has a reference which is not specified anywhere (Please check the Response schema section of question ).
API Link: https://developer.sabre.com/docs/rest_apis/air/book/create_passenger_name_record/
Response Schema:
In the response, there is a reference to http://services.sabre.com/STL_Payload/v02_02 which is not existing.
File : http://files.developer.sabre.com/doc/providerdoc/STPS/create_passenger_name_record/v200/CreatePassengerNameRecord2.0.0RS.json
....
"CreatePassengerNameRecordRS" : {
"type" : "object",
"title" : "CreatePassengerNameRecordRS",
"properties" : {
"version" : {
"type" : "string",
"minLength" : 1,
"maxLength" : 255
},
"ApplicationResults" : {
"$ref" : "http://services.sabre.com/STL_Payload/v02_02#/definitions/ApplicationResults"
....
It would be great it you could provide the latest file for the STL_Payload or update the documentation to the latest working version.

The missing files were added to the documentation page.
This should allow you to move forward.
The id-s are still used as tags and not as absolute resource pointers so you still need to play with it they way you described to make the auto-generation working out of the box.
We will consider your request to convert them to resource pointers in the future.
Just one more hint: if you are using Java-API version of jsonschema2pojo please use this for config:
GenerationConfig config = new DefaultGenerationConfig() {
public String getRefFragmentPathDelimiters() {
return "#/";
}
};
You need it because the default path delimiters in jsonschema2pojo are "#/." and the "." does not work with some of the types declared in the schema like Text.Long

+1 Sabre please make JSON schema available on http://services.sabre.com as it is problematic when generating models using Quicktype. Types are not being resolved correctly.

Related

What is GRAPHDB_CONTEXT_TEST in Graphdb?

I am trying to set a new repository in GraphDB. The npm documentation say that
GRAPHDB_CONTEXT_TEST = 'http://ont.enapso.com/repo'; where is this "http://ont.enapso.com/repo" coming from?
Also, why do we need { prefix: 'entest', iri: 'http://ont.enapso.com/test#' } ?
In the test repository, it is:
But I don't understand if the inside the quotes is just a string, or a link?
GRAPHDB_CONTEXT_TEST = 'http://ont.enapso.com/repo';
This is the global variable in which we have 'http://ont.enapso.com/repo', which is to define which named graph would be used.
{ prefix: 'entest', iri: 'http://ont.enapso.com/test#' }
These are the prefixes that we could pass in along with their IRI. They are used to perform SPARQL queries which require your prefixes.
We pass the IRI inside the quotes referred to as an internationalized resource identifier. It is used to identify uniquely.
You can also check the updated documentation of the pack available at
ENAPSO GraphDB Client
ENAPSO GraphDB Admin
Hope that answers your questions.

Using r googledrive package to create custom property

According to the documentation for drive_mkdir() in the googledrive package, "Named parameters to pass along to the Drive API. Has the tidy dots semantics that come from using rlang::list2(). You can affect the metadata of the target file by specifying properties of the Files resource via .... Read the "Request body" section of the Drive API docs for the associated endpoint to learn about relevant parameters." In the Google Drive API, it lists adding custom properties as, "Custom file properties are key/value pairs used to store custom metadata for a file, such as tags, IDs from other data stores, information shared between workflow applications, and so on.
To add properties visible to all apps, use the properties field of files resource."
In the Google API Files Page, it lists it as
"properties": {
(key): string}
I've tried a number of different ways to pass a value, but nothing seems to work. Does anyone have an example of adding a custom property while creating a folder?
Here is one example I've tried that does not work:
GDriveTarget <- "https://drive.google.com/drive/u/1/folders/'etc'"
drID <- drive_get(GDriveTarget, verbose = TRUE)
gProps <-list2(properties = c("Region","Far Northeast"))
curFolder <- drive_mkdir(name="School Folders",
path=GDriveTarget,
gProps)
this results in:
Error: These parameters are unknown:
Backtrace:
googledrive::drive_mkdir(...)
googledrive::drive_create(...)
googledrive::request_generate(...)
gargle::request_develop(endpoint = ept, params = params)
gargle:::check_params(params, endpoint$parameters)
gargle:::stop_bad_params(unknown, reason = "unknown")
Removing "gProps" creates the desired folder, so I have the proper rights. I'm just unsure how to pass the parameters Google is expecting. When I use the "try this API" tool on Google Developer, what it is expecting is:
{
"properties": {
"Region": "Far Northeast"
}
}

Deploying Microsoft.Maps/account

I have used an ARM Template to deploy a Microsoft.Maps/account resource to Azure.
That was successful:
Resource Microsoft.Maps/accounts 'nzmoebasedemo0000bt' provisioning status is succeeded
I'd like to retrieve the Primary key generated, within the ARM template, in order to persist it to a KeyVault.
I looked in https://resource.azure.com but the Maps/account provider was not listed, so could find no hint as to what property to read.
I tried:
[listKeys(resourceId('Microsoft.Maps/account', 'parameters('keyVaultVaultSecretMapsAccountResourceName')'), providers('Microsoft.Maps', 'account').apiVersions[0]).keys[0].value]"
Abd got back:
#{parameters=; status=Trial run failed. ; outputs=; provisionStateSucceeded=False; deploymentOutput=; errorCode=InvalidTemplate; errorMessage=Deployment template validation failed: 'The template resource 'azure.arm.base.keyVault.vault.secret' at line '168' and column '9' is not valid: Unable to evaluate template language function 'providers': function requires the second argument to be a multi-segmented resource type excluding the resource provider namespace. Invalid function argument 'account'. Please see https://aka.ms/arm-template-expressions/#providers for usage details.. Please see https://aka.ms/arm-template-expressions for usage details.'.}
Which in this case...seems incorrect.
What am I not seeing/getting?
Thanks!
Edit:
As per suggestion given, the following did pass a test run.
"[listKeys(resourceId('Microsoft.Maps/account', parameters('keyVaultVaultSecretMapsAccountResourceName')), '2018-05-01').keys[0].value]"
But when actually run, got the following:
1:02:35 AM - Resource Microsoft.Maps/account 'nzmoebasedemo0000bt' failed with message '{
"error": {
"code": "InvalidResourceType",
"message": "The resource type could not be found in the namespace 'Microsoft.Maps' for api version '2018-05-01'."
}
}'
Edit again:
As per guidance given in the comments, the following works! (after correcting api version, spelling mistake, and using 'primaryKey' property:
"[listKeys(resourceId('Microsoft.Maps/accounts', parameters('keyVaultVaultSecretMapsAccountsResourceName')), '2018-05-01').primaryKey]"
So the problem was due to a typo, the provider\resource is Microsoft.Maps/accounts

Change default flash messages in Sonata admin

I need to change default success message when we get after creating an item into my own success message. After few digging I found out how to create new flash messages but change existing messages is still a mystery to me.
This is my config.yml file
#app/config/config.yml
sonata_core:
flashmessage:
success:
types:
- { type: mytodo_success, domain: AdminBundle}
Admin class,
public function postPersist($object) {
$this->getRequest()->getSession()->getFlashBag()->add("mytodo_success", "My To-Do custom success message");
}
It would be great if someone can help me on this. I need to change default success message witch gives 'flash_create_success' to my own message.
You can create your own "translation" file .. and put it in your local resources... here's the original
https://github.com/sonata-project/SonataAdminBundle/blob/master/Resources/translations/SonataAdminBundle.en.xliff
the success message lives there ... just change the English "translation" to whatever you need... if you are using <= symfony 2.8 you can put the file in
app/Resources/SonataAdminBundle/translations/SonataAdminBundle.en.xliff
after clearing your cache.. you should be able to see new message without doing anything more...

iron:router wildcard path generating seems to be broken

When you create a wildcard URL in iron:router for meteor the pathFor Template helper but also Router.go and Router.routes[routeName].path() seems to be broken.
This is our route:
Router.route('/:urlQuery*', function(){
this.render('ourTemplate');
}, {
name : 'ourRoute',
});
To accessing a generated url to this we tried the following:
Router.go('ourRoute', {urlQuery : 'test'});
Router.go('ourRoute', {urlQuery : ['test']});
Router.go('ourRoute', {urlQuery : null});
Router.go('ourRoute', {urlQuery : false});
Router.routes.ourRoute.path({urlQuery : 'test'});
Router.routes.ourRoute.path({urlQuery : ['test']});
Router.routes.ourRoute.path({urlQuery : null});
Router.routes.ourRoute.path({urlQuery : false});
And - of course - also we tried the {{pathFor}} Template-Helper.
Every of these lines of code throw the same errors:
Uncaught Error: You are trying to access a wild card parameter at index 0 but the value of params at that index is undefined
I did not find any reference in the iron:router guide so my question is: How to generate a URL in iron:router with a wildcard as parameter ?
Looks like Iron Router is using path-to-regexp but the format is a little different when used in Iron Router and not very clear. Try this...
Router.route('/:urlQuery(.*)', function(){
The (.) will tell it to take the param name, and repeat it 0 or more times. Just urlQuery is breaking the name I think, and making it part of the regex. Now if you want to pass an array of mulitple objects to Router.go, you will have another issue...
Router.go("our.route", {urlquery: ['test', 'another']});
Produces a URL that looks like this...
http://localhost:3000/test%2Canother
but that's a different issue I don't have an answer for yet. Perhaps for sending multiple's in Router.go, a better way would be to concat them yourself. Looks like iron router and path-to-regexp are not fully integrated yet?

Resources