this may be trivial question, but I am having problems understanding server variables and how to modify them on swagger.
My objective is to create a server using the specs below (5G 3gpp definitions for of its interfaces).
https://www.3gpp.org/ftp/Specs/archive/OpenAPI/Rel-16/TS29122_PfdManagement.yaml.
As you can see at the top of this file we have a server variable called apiRoot which defines the root of the url of the server. That is set up to default value of example.com. That url will later be used by swagger-ui to provide a graphic interface to the API.
servers:
- url: '{apiRoot}/nnef-eventexposure/v1'
variables:
apiRoot:
default: https://example.com
description: apiRoot as defined in clause 4.4 of 3GPP TS 29.501
I am trying to generate the server with the swagger-codegen which generates a consolidated file with all the elements this spec needs (since the original yaml file contains references to other files)
swagger-codegen generate -i https://www.3gpp.org/ftp/Specs/archive/OpenAPI/Rel-16/TS29122_PfdManagement.yaml -l go-server -o server
The problem is the file embeds the default value. So I can not use that file on multiple hosts.
Is there any way to modify variable apiRoot when executing swagger-codegen? Or even better, is there any way to change the value of the default using some kind of envar? Or is there any way to pass swagger the value of apiRoot
The idea is we can use the same specs in different servers without having to modify the original spec file or the generated one. The problem with modifying the yaml files is that there will be more versions comming from 3gpp which will include apiRoot variable, so we don't wang to keep modifying every single time. We would like to overwrite it somehow on runtime.
Related
I'm currently working on open62541. I created one object XML file. now I want to add the file to server and try to run server. when server runs the XML file contain objects should be show on opcua-client application.
In 3 steps:
you need a nodeset.xml file
use cmake command to generate source code from it
call a function in your executable
1
I do not know what kind of "XML" file you have.
I would assume you have a valid nodeset.xml file.
if you do not know how to do it,you can try read this: https://opcua.rocks/custom-information-models/
personally i suggest to use a GUI tool for that (e.g. free opc ua modeler)
2
Then you should use following custom CMake commands provides by open62541
# Generate types and namespace for DI
ua_generate_nodeset_and_datatypes(
NAME "di" # the name you want
FILE_CSV "${UA_NODESET_DIR}/DI/OpcUaDiModel.csv"
FILE_BSD "${UA_NODESET_DIR}/DI/Opc.Ua.Di.Types.bsd"
NAMESPACE_MAP "2:http://opcfoundation.org/UA/DI/"
FILE_NS "${UA_NODESET_DIR}/DI/Opc.Ua.Di.NodeSet2.xml"
)
after build, you would find bunches of ua_xxxx_generated.c and ua_xxxx——generated.h file under build/src_generated folder.
Then in your programm code just include these headers and call
3
namespace_xxx_nodeset_generated(server)
please refer to https://github.com/open62541/open62541/tree/master/examples/nodeset
and
http://www.open62541.org/doc/master/nodeset_compiler.html
There are rich example and codes for that
In a similar use case as in Read Karate config from YAML I want to read my environment config for Karate from a YAML file. This works well with karate.read. My extended use case now would be the following:
read environment config of common environments from a YAML file which is in version control
have a file with custom environments not in version control and read from that file too
for all environments (based on a ID field) that are defined in both files the custom environment definition overwrites the common one
I now have to read two files but for the file with the custom environments I don't know if it will exist because the user might choose to not have any custom environments defined. Is there a way to check if the second file exists before attempting to read it? I have checked the documentation for the karate object but have not found anything like that.
If that wouldn't be possible, is there another way how my use case could be implemented?
Karate has a built-in way to use dev-env specifc config that may not exist: https://github.com/intuit/karate#environment-specific-config
That said, note that you can catch exceptions in JS, so that gives you some more options: https://stackoverflow.com/a/54554175/143475
try {
// read
} catch(e) {
// print e if needed and ignore
}
I am using gradle 6.8 and MarkLogic version is 10.0-5.2,
My XQuery code is in directory \ml-gradle\src\main\common. When I run the command mlLoadModules to load XQuery into the modules database it loads with default URI /common/test.xqy.
I want to add some prefix to the URIs e.g. /rsc/common/test.xqy. How can I achieve that?
Note: I don't want to create an extra folder in my source for prefix "rsc".
It's not supported, though you could write a custom Gradle task to change the URI to whatever you like.
Why do you not want to create an "rsc" folder above "common"? I think other developers would find it much more intuitive that "rsc/common/test.xqy" becomes "/rsc/common/test.xqy" when loaded, rather than "common/test.xqy" becomes "rsc/common/test.xqy", which begs the question - where is "rsc" coming from? And then that developer would need to understand what property / custom code is adding that "rsc".
I have used the latest connector from Rally and set it up with Task Scheduler to run periodically. It works well, however I have encountered problems when trying to extend it.
Within the config.yml file used, there is an UpdateArtifactState flag that I believe, when set to True, will make use of the statex.rb file. This file handles how the commit message from SVN is parsed. It is here that I find my problem;
I want to extend the connector to allow for the # symbol to be included in the Rally task identifier (DE55555 -> #DE5555 for example). However, upon testing this file does not seem to be used.
Question: if my assumption is correct, and the statex.rb file is merely an example and not used in execution, how can I extend the Rally Connector to pick up tags the way I see fit?
You may try the following:
make a new Ruby class and put it in to the extension subdirectory.
Example: extension/my_state_extractor.rb
in this file he has a class defined as 'MyStateExtractor'
Pattern your file from the statex.rb file.
Then, in your config in the Rally section, you'll need an entry of
StateExtractorClass : MyStateExtractor(message)
Customarily this entry will follow the entry for UpdateArtifactState : True
I'm developing an API Server in Go and the server (at the moment) handles all translations for clients. When an API client fetches particular data it also asks for the translations that are available for the given section.
Ideally I want to have the following folder structure:
/messages
/home.en
/home.fr
/home.sv
/news.en
/news.fr
/news.sv
Where news and home are distinct modules.
Now the question I have for Revel is is it possible to fetch ALL language strings for a given module and given locale? For example pull all home strings for en-US.
EDIT:
I would like the output (something I can return to the client) a key:value string of translations.
Any guidance would be appreciated.
It seems to me that revel uses messaged based translation (just like gettext does), so you need
the original string to get the translation. These strings are stored in Config objects,
which are themselves stored in messages of i18n.go, sorted by language.
As you can see, this mapping is not exported, so you can't access it. The best way
to fix this is to write a function for what you want (getting the config by supplying a language)
or exporting one of the existing functions and create a pull request for revel.
You may workaround this by copying the code of loadMessageFile or by forking your version
of revel and exporting loadMessageFile or parseMessagesFile. This also is a great opportunity
to create a pull request.
Note that the localizations are stored in a INI file format parsed by robfig/config,
so manually parsing is also an option (although not recommended).