Redocly File References With Different Wording? - openapi

We have references in the OpenAPI to separate files, like described below. The problem is the description should be different in many cases but only by one word. For instance, in some cases it's "business unit", others as "consumer unit", and so on.
My question is, is it possible to pass in different words without having to create different files? How do others handle this case?
In the OpenAPI file:
consumerId:
$ref: 'components/schemas/consumerid.yaml'
The (truncated) destination file:
type: string
description: |
Specifies the business unit.
example: 49304

Related

Can you use an `enum` with an input in GitHub Action's `action.yml` and a workflow file?

I have a GitHub action (in .github/actions/my-custom-action) that takes an input which is an enum. In action.yml:
inputs:
my-enum-input:
description: "This is an input that's an enum"
default: "all"
required: true
Where INPUT_MY_ENUM_INPUT has a type like ['all', 'a', 'b'] that's checked in the script file called by the action.yml file. Is there a way to enforce the enum in the action.yml file as an input, and check the Worksheet YAML file that calls the action to make sure it's valid?
It looks like a lot of people wanted this feature and the GitHub team added it. I can't find it anywhere in their docs but it is documented in their blog post announcing the feature. If you declare an input variable name of type choice you can limit the list of input options as shown below:
inputs:
name:
type: choice
description: Who to greet
options:
- monalisa
- cschleiden
There is currently no way for a GitHub Action to take a list/enum as input type, only strings are accepted at this time. There are a bunch of topics on this on the GitHub forums:
https://github.community/t/can-workflow-dispatch-input-be-option-list/127338
https://github.community/t/can-action-inputs-be-arrays/16457

creating a metadata driven pipeline - parameterizing a source file

I have CSV files that are placed in various folders on a blob storage container.
These files will map to a table in a database, and we will use ADF to copy the data to the database.
The aim is to have the pipeline metadata-driven. We have a file that contains JSON with details of each source file and sink table.
[
{
"sourceContainer":"container1",
"sourceFolder":"folder1",
"sourceFile":"datafile.csv",
"sinkTable":"staging1"
},
{
"sourceContainer":"container1",
"sourceFolder":"folder2",
"sourceFile":"datafile2.csv",
"sinkTable":"staging2"
}
]
A for each will look through these values, place them in variables and use them to load the appropriate table from the appropriate CSV.
The issue is, for a CSV source dataset, I cannot parameterize the source dataset with user variables (fields marked with a red x in the below screenshot).
Would appreciate advice on how to tackle this.
The feature is definitely supported, so I'm not sure what you mean by "cannot parameterize". Here is an example of defining the parameters:
And here is an example of referencing them:
I recommend you use the "Add dynamic content" link and the expression builder to get the correct reference.
If you are having some other issue, please describe it in more detail.

Add an Intro page to exam in R/exams

I am using R/exams to generate Moodle exams (Thanks Achim and team). I would like to make an introductory page to set the scenario for the exam. Is there a way to do it? (Now, I am generating a schoice with answerlist blank.)
Thanks!
João Marôco
Usually, I wouldn't do this "inside" the exam but "outside". In Moodle you can include a "Description" in the "General Settings" when editing the quiz. This is where I would put all the general information so that students read this before starting with the actual questions.
If you want to include R-generated content (R output, graphics, data, ...) in this description I would usually include this in "Question 1" rather than as a "Question 0" without any actual questions.
The "description" question type could be used for the latter, though. However, it is currently not supported in exams2moodle() (I'll put it on the wishlist). You could manually work around this in the following steps:
Create a string question with the desired content and set the associated expoints to 0.
Generate the Moodle XML output as usual with exams2moodle().
Open the XML file in a text editor or simply within RStudio and replace <question type="shortanswer"> with <question type="description"> for the relevant questions.
In the XML file omit the <answer>...</answer> for the relevant questions.
Caveat: As you are aware it is technically possible to share the same data across subsequent exercises within the same exam. If .Rnw exercises are used, all variables from the exercises are created in the global environment (.GlobalEnv) and can be easily accessed anyway. If .Rmd exercises are used, it is necessary to set the envir argument to a dedicated shared environment (e.g., .GlobalEnv or a new.env()) in exams2moodle(..., envir = ...). However, if this is done then no random exercises must be drawn in Moodle because this would break up the connections between the exercises (i.e., the first replication in Question 1 is not necessarily followed by by the first replication in Question 2). Instead you have to put together tests with a fixed selection of exercises (i.e., always the first replication for all questions or the second replication for all questions, ...).

Setting BOT properties in AIML

In AIML I have seen various files where the Bot properties is being used. For example :
<bot name="name" />
Here, the bot name is being used, but I am not able to find the place where to set this property, i.e. where should I define the name.
On searching I found that its stored in the .properties (link) file, but I cannot find the file anywhere.
There is also a github repsitory which has many files and used the bot properties, but here also no .properties file : Repo Link
So, where should I store the .properties file and if not then how should I add the bot properties in AIML.
As the AIML 2.0 working draft said:
The AIML standard does not specify where or how the properties, sets, maps,
substitutions and predicates are defined. This is an implementation detail
left up to the interpreter designer.
As an example, I am working with program-ab which is a Java implementation of the AIML interpreter.
The properties info of a bot is placed in a file named
config/properties.txt.
The format is like:
name: Alice
age: 22
gender: female
You can find more info about the program-ab configurations at Configuration.wiki.
If you are working with other kinds of implementation such as Python or whatever, the properties file path and its format may be found inside the wiki or docs.

Swift NSLocalizedString practical use

I couldn't understand and find any sources that showed me the practical use of NSLocalizedString. Even Apple documentation..
NSLocalizedString(<#key: String#>, tableName: <#String?#>,
bundle: <#NSBundle#>, value: <#String#>, comment: <#String#>)
Ok so lets say I created this in a file, how do I write this for different languages?
Do I create a localized version of the whole file like: en.thisfile.swift , es.thisfile.swift, fr.thisfile.swift?
Or do I create new languages in different bundles or tables?
NSLocalizedString("hello", tableName: "en", value: "hello", comment: "wtf is this anyways?")
NSLocalizedString("hello", tableName: "fr", value: "bonjour", comment: "wtf is this anyways?")
NSLocalizedString("hello", tableName: "es", value: "hola", comment: "wtf is this anyways?")
And then how do I use it in a random file after setting it up?
println("dat nslocalizedstring I created, which will automatically know what to write??")
The table is the name of the file that defines the string, for example, table "ErrorMessages" will define a file called ErrorMessages.strings.
If no table is specified, the file will be the default Localizable.strings. The format of the file is a list of the following:
/* This is displayed when the entity is not found. */
"MSG_object_not_found" = "Object not found. Please, try again.";
Where the first line is the comment, the value on the left side is the key that identifies the string and the value on the right side is the actual localized value.
Usually, you can use the English value as the key (the 2 parameter version of NSLocalizedString). The language name (en, fr, es) is not part of the method call.
All of this is there to make translation simple. Note that most translators won't understand or even see the application, that's why it's important to have a good comment to provide a context for the message. There are examples of funny translation all over the internet which were created because the context was missing and the translators didn't know what they were translating.
Basically, your code will contain the texts in your main language and then you will generate the .strings files from your code using genstring tool (See this for more info). Then you will give the files to your translator, add the translated files to your application (every language in a different folder) and the application will select the correct files at runtime depending on the language selected by the user.