open-api generator not coonverting ~1 into slashes - swagger

I have an issue with open-api generator
We have a yaml that contains $ref:'#/paths/~1name/
But the ~1 is not escaped.
Is there a configuration i am missing?
I have tried io.swagger.codegen.v3 and open-api-generator
Edit with open-api generator i see the issue of them still not supporting allOf and with swagger i see the issue of it not working with the ~1 path

Related

Are backslashes supported in Groovy comments?

I experienced a weird Jenkins error while trying to run a groovy-scripted pipeline that contained backslashes inside comments.
Here is the offending code:
// The script below depends on:
// * The presence of a recent nuget.exe in c:\tools (v5.7)
// * The presence of the xxx plugin installed for user foo\username
I'm aware the backslash is used in many languages to start an escape sequence, but I had never before experienced backslashes being an issue inside comments.
I wonder if this backslash in comments behavior is due to Groovy itself or rather a bug in the way Jenkins interprets it...
Edit: I solved my issue by replacing the offending \ with \\ but then noticed I had forgotten to double the backslash in c:\tools, and still Jenkins did not complain. It seems Jenkins (or Groovy) tried to interpret the \u in foo\username as introducing an hex character code... but was okay with \t for it probably was interpreted as a tab!

OpenNLP Name Finder training: Unsupported language: en

I'm trying to test training OpenNLP's Name Finder on some data, according to the guide in the documentation. However, I encountered the error: Unsupported language: en, which doesn't seem to make any sense.
The command I ran is: opennlp TokenNameFinderTrainer.conll03 -model model.bin -lang en -types per,loc,org,misc -data train.txt -encoding UTF-8
I downloaded OpenNLP 1.9.0 from https://opennlp.apache.org/download.html. The OPENNLP_HOME environment variable does seem to be properly set, and the lang folder in the base folder contains an en folder.
EDIT: This seems to have something to do with the CoNLL2003 format. If I try to run the trainer directly without specifying .conll2003 it works. However my input data is in CoNLL 2003 format. Running TokenNameFinderConverter gives me the same error. Even trying it on the official example https://github.com/apache/opennlp/blob/master/opennlp-tools/src/test/resources/opennlp/tools/formats/conll2003-en.sample doesn't work.
OK so apparently in a certain version after 1.5.3, for CoNLL-2003 related commands, OpenNLP changed the language codes from two characters to three characters, i.e. one should have passed in eng instead of en. But the documentation was never updated on this. (There are various outdated portions of the documentation.) Was banging my head for 2 hours trying to figure it out! I made a PR to fix the documentation.

Seeing Bad parsing rule for Jenkins Log parser plugin

I am trying to use Log Parser Plugin with Jenkins. Following is my rule file which I have taken from the sample given on the link.
# match line starting with 'error', case-insensitive
error /(?i)^error/
# list of warnings here...
warning /[Ww]arning/
warning /WARNING/
# create a quick access link to lines in the report containing 'INFO'
info /INFO/
# each line containing 'BUILD' represents the start of a section for grouping errors and warnings found after the line.
# also creates a quick access link.
start /BUILD/
I still see following at the end of the Parsed Console Output page:
NOTE: Some bad parsing rules have been found:
Bad parsing rule: , Error:1
Bad parsing rule: , Error:1
Bad parsing rule: , Error:1
I did come across this, but dint help as I am not using space anywhere.
Can someone help me resolving this issue?
It appears you have extra white-space somewhere in the file that the plugin is interpreting as you attempting to define a rule. Maybe try running it with the empty lines removed. That plugin has given me quite a bit of trouble as well, it's not very well documented (as is the case with many Jenkins plugins).
I had tried no spaces in the pattern, but that did not work. Turns out that the Parsing Rules files does not support empty lines in it. Once I removed the empty lines, I did not get this "Bad parsing rule: , Error:1".
I think since the line is empty - it doesn't echo any rule after the first colon. Would have been nice it the line number was reported where the problem is.
I posted the same to this thread too - Log parsing rules in Jenkins
Hopefully, it helps out other folks who may be wondering what is causing this.

How to get Swagger UI to use my titles?

I am using Swagger-php and Swagger-UI and it all works just fine but for one annoyance. The UI that Swagger-UI creates has the expected click-to-expand sections for my API routes, but the title of each one appears to be the JSON file generated and not any name I can give it. After the title, the description is the one I give in my annotation, but the title I seem to have no control over.
So if I have routes that begin with a resourcePath of /foo, and a description that says "Foo API Functions," the UI looks like:
foo.json : Foo API Functions
I don't want "foo.json" I'd much rather specify what this says. Like just "Foo" or even "Foo Functions" and then change my description to something more meaningful like, "This is where you find the foo functions."
Am I missing which annotation to use for this?
If you manually edit the api-docs.json file. You can replace the .json with .{format} and all will display correctly and function correctly. Not sure why the .{format} is not inserted by default. Slightly annoying.
I too ran into this problem, but I couldn't find anything on either theswagger-php or swagger-ui github pages mentioning this. So, I wrote a short build script (assuming a Unix-like OS) as a work around, which will first build all the docs using swagger.phar and then run sed to do an inline string replace on the problematic string. Here is what I did below:
#!/bin/bash
# write API documentation from "src" directory to the "docs" directory
/usr/bin/php swagger.phar src -o docs
# replace instances of "json" with "{format}" to fix swagger-php formatting issue
sed -i -e 's/json/{format}/g' docs/api-docs.json
Fixed in swagger-php 0.9.1
I don't know why swagger-ui strips out ".{format}" but not ".json"
The .{format} was not inserted by default because it might be confusing. It suggests the presence of different formats and swagger-php only supports the json format.

Plain text emails with Rails/Slim

I've just converted my Rails 4 app from Haml to Slim. Everything went well but I can't get plain text emails to work.
I used the haml2slim converter. It automatically changed my filenames to filename.text.plain.slim.
When I run my tests, each one related to Mailers fails with an "ActionView::MissingTemplate" error.
I think your template name should be filename.text.slim instead of filename.text.plain.slim.

Resources