I'm trying to integrate our RESTEasy API with swagger-ui to allow external module developers to test against our interface.
My knowledge is a little hazy when it comes to the support of existing APIs. The service containing the REST API is an application packaged into an *.ear file deployed on a JBoss EAP 7.4 Server.
I deployed the *.dist folder of swagger-ui on the undertow web-server and swagger-ui is accessible. So far so good.
My question is now: is it at all possible to have swagger detect the resource contents of the *.ear file without my having to configure the swagger.json manually, or, alternatively, package it into a *.war file and deploy it on the EAP?
If so, how to proceed? Do I need the swagger-codegen, the inspector oder will just the UI somehow work?
Thanks for any pointers.
Swagger can't automatically detect those. But if you're already exposing the swagger.json file in your ear, then maybe you can just change the swagger-ui source to look for that specific address when starting up. You should change the url property in the following code to point to your own:
window.onload = function() {
//<editor-fold desc="Changeable Configuration Block">
window.ui = SwaggerUIBundle({
"dom_id": "#swagger-ui",
deepLinking: true,
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
layout: "StandaloneLayout",
queryConfigEnabled: true,
validatorUrl: "https://validator.swagger.io/validator",
url: "https://YOUR_SERVER/CONTEXT_PATH/swagger.json" // <-- CHANGE THIS URL
})
//</editor-fold>
};
Also if you're using a more recent versions of the WildFly, there is a dedicated subsystem named microprofile-openapi-smallrye that you can enable to generate the json file for you automatically. You can find more details about it in this tutorial.
Related
I am trying to make a desktop application with electronjs. Since nestjs makes the back-end development super-easy, I want to use it with electron.
Initially I tried to run the command
electron . && nest start
This makes the nest process start only after the electron app is closed.
I found only one video on youtube for this and no other proper solution elsewhere.
link: https://www.youtube.com/watch?v=vWpybfpyzPI
I was having difficulty in understanding it.
I also wanted to know the possibility of smooth communication between electron and nestjs if I am able to achieve what has been achieved in the video. It doesn't seem like a standard thing to me.
This is not easy but not impossible as well...
I will assume that you are going to create some angular frontend application along with local nestjs api server... Then we can do this with following tricks...
Create electron + angular app using xplat
Create your local nestjs application.
For production builds do the following trick..
a) In electron index.ts file add the following may be in create window function.
if (!serve) {
const { fork } = require('child_process');
const ps = fork(${__dirname}/main.js);
}
a.1) first build your Web Application.
b) build your nestjs application and then copy nestjs node_modules plus nestjs dist into your angular dist.
c) using electron_builder generate your packages and make sure electron builder will copy node_modules.. by default it will ignore it but we can pass some arguments to electron builder... by using package.json
something like below...
"files":[
"/*",
{
"from": "node_modules",
"to": "node_modules",
"filter": ["/*"]
}
],
Note : for serving we dont need to run nestjs in electron all we need is to serve nestjs separately...
I have backend system in Web API using asp.net core where I am using Swashbuckle.AspNetCore package for generating OpenAPI Specification document. The OpenAPI specification document is generating fine something like '~/swagger.json'. I hookup this url in APIM via OpenAPI specification it works like a charm.
However if the '~/swagger.json' gets updated due to adding new operation,documentation and so on. The changes are not getting reflected in APIM. How can I solve this problem?
If APIM is not able to detect the changes automatically then can I mention the url '~/swagger.json' in ARM template something like that and while doing complete deployment of the APIM for e.g.in other or higher environment the spec gets reflected there. I also tried to download the ARM template from portal I was not able to see a place where I can specify '~/swagger.json' url.
There is option from UI to import spec again but any easy automated way of doing this would be appreciated
Ues PUT /apis/... call in Azure APIM rest API and specify below as payload:
{
"properties": {
"format": "swagger-link-json",
"value": "https://contoso.com/swagger.json"
}
}
Docs: https://learn.microsoft.com/en-us/rest/api/apimanagement/2019-12-01/apis/createorupdate#contentformat
I am on an Electron + Create React App stack.
I am using Electron Updater (https://github.com/develar/electron-updater) for auto updates.
Platform: Linux, Format: AppImage.
When my app checks for updates, I get the following error:
APPIMAGE env is not defined.
Has someone experienced the same issue? Suggestions required.
Please don't use electron-updater anymore, since it is no longer supported according to its GitHub page.
Most often, this occurs when you are trying to use the auto updater in development mode (or non-packaged AppImage mode). It only works in a packed production build.
For me however, this also occurred in a packed AppImage, and turned out to be caused by using the webpack DefinePlugin, like this:
plugins: [
new webpack.DefinePlugin({
"process.env": {
NODE_ENV: JSON.stringify("production")
},
...
Removing the process.env definition allowed APPIMAGE to be defined once again in the distributed package. It seems the rest of the definitions can be left in place safely without breaking the auto-updater.
If removing this definition is not possible for your use-case, according to some users it's possible to simply override it at the beginning of your main thread (not renderer thread) file like this:
process.env.APPIMAGE = path.join(__dirname, 'dist', `MyApp-${app.getVersion()}.AppImage`)
... obviously with the correct file name in the 3rd argument of Path.join.
This override approach didn't seem to do anything for me though, so I myself went with simply removing process.env from the DefinePlugin definitions, but it may help in other cases.
try to use electron-builder for building your app cause this module is is in maintainance only mode.
the autoUpdate for linux is not possible, you can do that only for mac and windows try to read this documentation.
I recently started using Sublime Text 3. I always save my web development work in USB drive.
Can I make Testing or Remote server in sublime3 like Dreamweaver
Mean's Sublime3 save my Testing or Remote (connection = local/network) Server Folder in C:\xampp\htdocs\TestSite\
and
Local Site Folder save in USB Drive e.g. x:\TestSite\
and I able to put and get files like Dreamweaver
How can I do this? I will greatly appreciate any helpful suggestion.
Synchronize Update Remote Server Files (Local/Network)
Install package SublimeSimpleSync with package control in sublime3,
After Installation go and open Preference>Package Setting>SublimeSimpleSync a file and ADD THIS CODE & SAVE
{
"config":
{
"autoSync": true,
"debug": false,
"timeout": 10
},
"rules":
[
{
"type" : "local",
// Apache Server Folder
"local" : "C:\\xampp\\htdocs\\TestSite\\",
// Local Site Folder save in USB Drive
"remote" : "N:\\TestSite\\"
}
]
}
This package {SublimeSimpleSync} use to update your USB folder files when you edit and save in Apache server Folder...
View In Browser {Configure to View on Local Server}
Install another package View In Browser with package control in sublime3, After Installation open sublime project file e.g. "TestSite.sublime-project" and ADD THIS CODE & SAVE
"settings":
{
"sublime-view-in-browser":
{
"baseUrl": "http://localhost:8080\\",
"basePath": "C:\\xampp\\htdocs\\"
}
}
Here localhost can be root URL or IP and 8080 is port no.
Now open a page in sublime (which you want to render in sever) and right click and in menu click View in Browser
Live Preview In Google Chrome Browser
For Live preview in Google Chrome search Extension LivePage in chrome web store and install it. Its is very use full for most up-to-date version of a loaded web page when you change in editor.
I am developing a service layer app which provides a catalog of webservices, then I am orchestrating them using OpenESB.
I create my BPELs importing external WSDL definitions using http://localhost:8080/services/myService?wsdl.
The problem is -- these BPELs strongly depend on this specific URL, and when I deploy on production server, my ESB layer stops working.
How can I make my BPELs independent of the specific endpoint? Can I refer the URIs to an external config file?
To do it you must create application configuration and application variable and add them on your http address. Example: "http://${MyHtttpAddress}:${MyHttpPort}/service1/myService?wsdl"/>.
Applications and variable are set up in the administrative console and can be changed for each environment.
Regards
Paul