Is it possible to change or configure the "/openapi" url on which OpenLiberty generates the OpenAPI documentation - openapi

Is it possible to change the url / context-root of the openapi documentation which openliberty generates (microprofile-5.0 and mpConfig-3.0)
By default this is generated on "/openapi" but I was wondering if this can be configured.
I tried to see if it was possible to configure this with mpConfig, with a config file microprofile-config.properties and tried to find more information/documentation/configuration for this this in the server.xml file

There is an open issue https://github.com/OpenLiberty/open-liberty/issues/17573 to allow changing this.

Related

Why web.<environment>.config is present after File Transform in release pipeline

In my release pipeline I am using File Transform option for my web.config.
I have web.config and web.staging.config
File transform is working and changes are applied in web.config but why web.staging.config is still present in the final deployed package.
Am I missing any configuration or this a normal behaviour?
For this issue , with XML file transformation, the web.xxx.config file is required. The transform will be applied when publish web app to web deploy package or publish to server directly per to the configuration.
As stated in the documentation: You need to create a Web Application package with the necessary configuration and transform files.
So if you want to removing all config transforms, as a workaround , you could add a Delete-files task in the end to remove all configuration files. For example:
Source Folder:
$(wwwRoot)\
Contents:
**\*.staging.config
Here is a case with similar issue , you can refer to it for details.

How to open a file in vscode from browser?

I want my webapp to be able to open a given file in VS code. For example, when I click a button on my webapp, a file say, C:\Users\...\myProject\index.html is opened, if myProject is already opened it should navigate to index.html
I know its a peculiar use case but I want to know if its possible in vscode.
Its also completely fine if it requires using browser or vscode extension.
vscode://file/{full path to project}/
Thanks to fbg13 for providing this link
It is possible if you are using Firefox:
Open the about:config page.
Set the view_source.editor.external to true.
Set the view_source.editor.path to the VSCode's executable absolute path.
It is possible if you add this link:
vscode://file/{fullpath}:{numrow}
Example for Symfony 5.3 and higher
For example in Symfony to use the link that appears in the debug bar of the controller used you can do it as described in the examples. You have to edit your project config.
Only for VS Code:
config\packages\framework.yaml
framework:
ide: 'vscode://file/%%f:%%l'
For any editor through env:
config\packages\framework.yaml
framework:
ide: '%env(resolve:CODE_EDITOR)%'
And don't forget to add value for CODE_EDITOR into .env or .env.local.
Local
This is an example for local projects.
.env or .env.local:
CODE_EDITOR=vscode
# or
CODE_EDITOR=vscode://file/%%f:%%l
Docker
If you use Docker or trying to open a file from remote server, you may use this example.
.env or .env.local:
# Template
CODE_EDITOR=vscode://file/%%f:%%l&/PATH/TO/YOUR/SERVER/APP>/PATH/TO/YOUR/LOCAL/APP
# Real paths
CODE_EDITOR=vscode://file/%%f:%%l&/app/>/home/user/projects/symfony_project/
For more details see these pages:
Symfony Framework Configuration Reference - ide
Opening VS Code with URLs
You can install vscode-handler to open files like this
vscode://open?url=file://%file&line=%line

Documenting REST APIs with Swagger Editor

I have to document the REST APIs for one of the application using the Swagger Editor. I have gone through few of the references available but nothing seems to show the start point on Documenting the APIs.
https://swagger.io/docs/swagger-tools/#installation-11
Have downloaded the Swagger Editor and want to start on documenting.
Any specific pointers to start on it would help.
Thanks.
With Regards,
-Nayan Parikh
I was able to start on the documenting the APIs. Following are the steps that i followed hope this would help someone in need.
Documenting using Swagger-Editor
Open the Swagger Editor online https://editor.swagger.io/
OR
Download from the link https://github.com/swagger-api/swagger-editor
Go to the folder swagger-editor and Run the index.html
This will open up the editor and start documenting the API based on the specification mentioned at https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md
Once that is done download the it as JSON or YAML file.
Viewing it on Swagger-UI
Download the swagger-ui from the link https://github.com/swagger-api/swagger-ui
Go to the dist folder and Edit the index.html.
Specify the JSON/YAML file you just downloaded above.
Check it by running the index.html
Hope this helps
Thanks.

Catalyst Log4perl: configure config file location from app config

In a Catalyst app, I need to specify the Log4perl's config file location. All the examples I could find suggest that I should do that from code. However, I would like to be able to specify it in the app config file. This would allow me to use different log configs for different environments and manage all that from a single file. I would also like to be able to set log levels from app config file.
However, there seems to be no documented way of configuring the logger from the app config file. I tried multiple variations of syntax, but none was picked up by Catalyst. It is also impossible to set the correct config file name from MyApp.pm (main app module), as configuration is not yet available when module code is run.
Debugging the logger initialization code also didn't help. The only real way I am considering now is to require a config file from MyApp.pm, which would include the necessary configuration.
The questions thus are:
Is there a way to specify the Log4perl config file location from Catalyst config file?
Is there a way to specify log levels from a config file?
I thought I'd googled enough, but apparently I hadn't.
__PACKAGE__->setup();
__PACKAGE__->log(Log::Log4perl::Catalyst->new(__PACKAGE__->path_to(__PACKAGE__->config->{Log}->{config_file})->stringify));
(ref http://www.gossamer-threads.com/lists/catalyst/users/31271).
And as for log levels: they are defined in the actual Log4perl config file.

Accessing an Ember CLI app's config from within an addon

I'm developing an addon for Ember CLI which requires me to dynamically load files from the app. I should be able to do this with a command like require('my-app/models/load-me'). The only problem is that my-app could be anything, depending on what the developer named their application. If I had access to the my-app/config/environment file, I could just get the modulePrefix from there, but unfortunately, that's also namespaced under my-app.
So does anyone know of another way to access the modulePrefix? I'm assuming there must be a way, because Ember CLI itself needs to get that prefix before it can load any files.
Found the answer here. Basically, you can look it up through the container like so:
this.container.lookupFactory('config:environment').modulePrefix;