SwashBuckle-Swagger-ui 2: Dictionaries are not interpreted (AdditionalProperties are not recognized) - swagger-ui

I'm using Swashbuckle 5.6 which is using Swagger-UI 2.2. Unfortunately the dictionaries are not interpreted because Swagger-ui doesn't interpret the additionalProperties of a Map.
The result of swagger-ui is :
MyNamespace.Models.DictionaryErrorModel {
ValidationErrors (inline_model, optional, read only)
}
inline_model {} // The inlimodel is empty!!!
I want to customize swagger-ui in order to fix this bug. Could anyone help me?
Thanks.

Related

How to convert swagger.json to openapi3 spec

I'm looking for a solution of converting swagger.json (generated by swagger2) to openapi3 json file in my CI/CD process (Git Actions).
I'm doing my job with Java, and I found some ways like:
Swagger inspector -> I guess it works in web env only.
SwaggerHub gradle plugin
Swagger codegen
but I have no experience of my task. which one is proper way to solve my problem? or is there any other way?
grateful for reading my question :)
Renew) I solved it completely, with using Swagger-parser
https://github.com/swagger-api/swagger-parser
example code is here:
#Test
public void parsingTest() throws Exception {
String outputDir = System.getProperty(YOUR_PATH_HERE);
SwaggerParseResult result = new OpenAPIParser().readLocation(YOUR_PATH_HERE, null, null);
OpenAPI api = result.getOpenAPI();
// POJO -> JSON
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.writeValue(new File(YOUR_PATH_HERE), api);
}
hope it makes helpful someone!

Does L.mapbox.featureLayer() support LineString?

I have followed mapbox.js documentation to implement geojson LineString over my map without success.
Does L.mapbox.featureLayer() support LineString?
Here is my code:
var myMarkers_sende = L.mapbox.featureLayer()
.addTo(map);
myMarkers_sende.loadURL('myurl/map_sende.geojson');
Thanks
Yes, L.mapbox.featureLayer does support the LineString geometry type. This is a problem somewhere else: enabling browser debugging might point out an issue in Javascript, or if you can provide more complete code & data, we could help debugging.

how to give files as links to servlet in anchor tag

I'm writing a servlet code to display files in the datbase and am trying to give file name as link in anchor tag but it shows error!.. some help please!, here's my code:
out.println("<body>");
out.println("<h1>Download list </h1>");
out.println("<table>");
while(rs.next()) {
String ns=rs.getString("uname");
out.println("<tr><td>File Name:</td>");
out.println("<td><a href="/Download">"+ns+"</td></tr>");
out.println("</table>");
}
out.println("</body>");
out.println("</html>");
try this;
out.println("<td><a href='/download'>" + ns + "</td></tr>");
we assume that,
your servlet url-pattern entry in web.xml is "/Download"
If you want to download a file with a parameter as file name, you should try something like -
out.println("<tr><td>File Name:</td>");
out.println("<td><a href="/Download?filename="+ns+">"+ns+"</td></tr>");
and then you should write the code for download functionality in the Servlet for the requested parameter - filename
Please elaborate us your error, so that we can help you in right direction to solve your problem.
Thanks

Convert sxw to rml error

When I try to convert sxw file to rml file using OpenOffice , this error occurs :
Exception: 'asci' codec can't encode character u'\xe9'
what's the meaning of that error? and how can I fix it?
please check this link UnicodeEncodeError when trying to convert Django models to XML This is the same issue that we got here.
You can use yourfield.encode("utf-8") or use format() in openerp. [[format(obj.your_str_field or '')]]
We have Similar issues posted on lp: https://bugs.launchpad.net/openobject-server/+bug/956798
and it has been fixed on linked branch you can take the patch apply, which will make your report to tolerate the Unicode encoding.
Thank You

Twitter API cursor based pagination (JSON issue) PHP

as you know Twitter has posted a new cursor based pagination for some API methods.
Currently, I'm facing a problem when encoding the json object because the cursor itself is actually a 64-bit numbers and not supported for json encoding in PHP.
next_cursor 1299072354878293926
Any solution for this? I can't believe why didn't Twitter just return string for it...hmmp
thx
PHP 5.2+ should convert 64-bit numbers to floats, which is better than previous versions of PHP (which would just convert it to the maximum 32-bit value). Best bet is to move to a 64-bit version of PHP, but updating to PHP 5.2+ will at least get you up and running.
If you are stuck with 32 bit system, you could convert the cursor to string using regex and then use it for further requests.
Here's PHP function that I am using to achieve this:
function jsonIntToStr($json){
$pattern = "/\"next_cursor\":([0-9]+),/";
$replace = "\"next_cursor\":\"$1\",";
$new_json = preg_replace($pattern, $replace, $json);
$pattern = "/\"previous_cursor\":([0-9]+),/";
$replace = "\"previous_cursor\":\"$1\",";
$new_json = preg_replace($pattern, $replace, $new_json);
return $new_json;
}
and you could use it like:
$json_result = json_decode(jsonIntToStr($twitter_response));
Got it from twitter development talk google group.
Since PHP 5.4.0 (currently in beta), it is possible to use the fourth parameter of json_encode and set it to JSON_BIGINT_AS_STRING.

Resources