How to customize the api version that appear in loopback 4 generated API explorer? - loopbackjs

Loopback 4 is showing a version number in the Api explorer and I'd like this version to follow the version of my component that is specified in the package.json .
How can this be achieved ?
Regards,

At this moment, you can modify the spec manually. First get the application's OpenAPI spec by calling app.restServer.getApiSpec()
Then modify the spec accordingly (change the version inside info to be the same as the version in package.json), and setting the new spec by calling app.api(your_new_spec)
LoopBack team is building an OpenAPI spec enhancer service to make ^ automatically happen by applying spec enhancers. See the usage and demo documentation in Extending-OpenAPI-specification
After finishing story Adding an enhancer service in the rest server, you will be able to modify the spec by applying your enhancer.

Related

Strongly typed calls to other microservices in LoopBack v4

I'm currently evaluating the suitability of LoopBack for a future microservice-based project. Moreover, I'm new to LoopBack, so please correct me, if a misunderstood the concepts of Loopback.
At times, you need an aggregator microservice which calls several others. Is it possible to generate a strongly typed client library stubs (in the form of a Service) analogous to the lb4 openapi command?
And if not, what is the point of using TypeScript (as advertized), when one has to use pure JavaScript as shown in these examples (1) (2)?
Also is there an option to use an OpenAPI spec file from existing services?
It seems to me that this is a 'terra incognita' at this point for LoopBack v4 with TypeScript.
Disclaimer: I'm a maintainer of LoopBack.
There are a few things involved here:
Communication between microservices - we support REST and gRPC via connectors, such as loopback-connector-openapi and loopback-connector-grpc.
As you mentioned, it's on the roadmap to generate service stubs - see https://github.com/strongloop/loopback-next/issues/1070#issuecomment-403530459. The lb4 openapi command has implemented a lot of logic that can be applied to lb4 openapi-stub. Contributions are welcome!
You should also check out https://github.com/strongloop/loopback4-example-shopping/pull/268.

Configuring WSO2 Identity Server as Key Manager with API Manager

I'm looking for some guidance about two specific WSO2 products, API Manager and Identity Server and for the best solution to solve the problem I'm going to explain below.
In my company, we are using ADFS 3.0 for Single Sign On support in our applications. However we are now building applications that will require OpenID Connect Specification (SPA's+Rest API's) and ADFS does not support this out of the box so we've decided to use WSO2 products for that purpose.
I already managed to install WSO2 Identity Server 5.0.0 SP1 and configured ADFS as a federated Identity Provider (the new applications will still have to authenticate users using ADFS). I also installed WSO2 API Manager 1.9.1 and configured it to use WSO2 Identity Server as the Key Manager (Configuration tutorial).
Now the problem:
Using WSO2 Identity Server 5.0.0 SP1 I couldn't get the Logout feature to work due to the issue reported here. It seems that this issue has been solved in version 5.1.0M4 so I tried to install version 5.1.0-alpha and managed to make the logout to work with ADFS (I tested it by enabling SSO for the carbon administration). However, now I'm not able to install the Key Manager feature through the carbon repositories due to incompatibilities.
As a result, with the first combination (wso2is 5.0.0 SP1/wso2am 1.9.1) I had the logout issue with ADFS and with the second combination (wso2is 5.1.0-alpha/wso2am 1.9.1), I'm not able to install the Key Manager feature in Identity Server.
Is there any way to apply a patch to solve the logout issue in the first combination? Is there a way to install the key manager feature on WSO2IS 5.1.0-alpha? Or can someone point me to another solution to solve this issue?
The issue you pointed above, marked as it type as "Patch". Usually that means WSO2 have fixed this issue for a earlier version and provided a patch to its customer. Easiest thing would be, if you are already a customer of WSO2 ask for the patch directly from their support.
If you are not a paid customer of WSO2 you are in bit of a trouble. As per this question, the source of the Service Pack also not available in public.
But luckily in your case, the component which need to have this fix not a core component. So you wouldn't be in trouble if you change the authenticator code bit. But the warning is, it would lose any fixes done for org.wso2.carbon.identity.application.authenticator.samlsso_4.2.1.jar in the service pack.
Anyway, these are the steps you should follow.
Checkout the source. Lazy path would be checkout the whole source from here. That is the most easy way which you will face less troubles when you try to build the source but the downside of that is, it would take bit of time to checkout. If you know how to build specific component from WSO2 source, you can directly checkout component it needed to changed.
Try to build the component without doing any change just to make sure there are not any issues upto this point.
Goto the class DefaultSAML2SSOManager and do the same change done in the PR.
Build the component again.
Create folder named like "patch9000" inside the <IS_HOME>/repository/components/patches/ folder.
Copy build jar (org.wso2.carbon.identity.application.authenticator.samlsso-4.2.1.jar ) in step 4 from the target folder to the <IS_HOME>/repository/components/patches/patch9000 folder.
Restart the server. If you have done everything to the point, in the server startup it would print a log like, org.wso2.carbon.server.extensions.PatchInstaller - Patch changes detected
Now retry the your flow and it would work as expected.
If you too lazy to do all above, you can wait until Identity Server Service Pack 2, which will have your fix.

Swagger with Resteasty 3 + Jetty 9.2 + JAX-RS 3

I am trying to configure an existing application to use Swagger. This application uses Resteasy 3 and Jetty 9.2 along with JAX-RS 3.
My changes are based on the explanations given on the Swagger wiki.
I have first added swagger 1.5.0 in my build.gradle before adding annotations #Api and #ApiOperation on a resource named SchedulerStateRest.
The next step was to edit my web.xml in order to hook up Swagger-Core in my Application and Initialize Swagger using Swagger's Servlet.
My issue is that when I launch my application, no resource is found when I browse /swagger.json or /swagger.yaml from http://localhost:8080. However, I get no error while starting Jetty and existing services are running and available.
I have enabled Jetty logs but I found no information relevant to me (the class in charge to launch Jetty embedded is JettyStarter).
By looking for similar problems, I found people who say that swagger content should be available at /v1/api-docs, so I tried different URLs but I always get a 404 error.
Recently, I found a gist from ben-manes for configuring swagger with Resteasy 3 + Guice 4. I tried to mimic its configuration and deduce the configuration for web.xml based on Guice-servlet explanations but I end up with the same problem as for the configuration explained above (no resource available are the expected address).
Since there is no error while starting embedded Jetty, I wonder if the issue is not related to a wrong address. Do you know how to list "resources" that are available on a Jetty instance?
I noticed that explanations on Swagger wiki are for Resteasy 2.X. Does it mean that Swagger is not compatible with Resteasy 3.x?
Ideas, suggestions, etc. to debug, solve the issue are welcome ;)
I actually figured it out yesterday. I'm going to post a sample application on git hub sometime this week since I can't find an example anywhere

Migration path for Fql.multiquery

I'm new to Facebook development. I'm working on migrating an existing app in accordance to the Graph API upgrade guide. I'm looking for guidance around calls such as api.facebook.com/method/Fql.multiquery.
My question is: does this type of API need to be upgraded as well, or does it only apply to graph.facebook.com calls? I want to ensure that api.facebook.com/method/Fql.multiquery calls will still work after 4/30/15.
You may want to take a look at the Batch Requests of the Graph API. You can also specify dependencies between the requests.
Calls to http://api.facebook.com/method/Fql.multiquery will no longer work. The REST API is long deprecated anyway.
As #luschn said, you have to migrate to the Graph APIs batch requests, and use the /fql endpoint. You can only use FQL if you have a v2.0 app, and not higher.

Asterisk and multitenant module for vtiger 6

I am new to vtiger. I would like to know is there any modules available for Asterisk and multitenant. If so can you please give me the link. I saw some post saying it will be in future release.
as per developers, setting PBX Manager back in action is planned in version 6.1
Meantime, you'll need to wait or create your custom module.
check out http://www.vtigerexperts.com/vtiger-crm-6-1-demo/
PBX manager is available in 6.1. For multi-tenancy you have to customize.