swagger-api / .github Goto Github PK
View Code? Open in Web Editor NEWCommon Github files for the Swagger projects
License: Apache License 2.0
Common Github files for the Swagger projects
License: Apache License 2.0
SwaggerParseResult giving merged results of Warnings and Error. there is no way can clearly separate from this list.
public SwaggerParseResult deserialize(JsonNode rootNode, String path) {
SwaggerParseResult result = new SwaggerParseResult();
ParseResult rootParse = new ParseResult();
OpenAPI api = this.parseRoot(rootNode, rootParse, path);
result.setOpenAPI(api);
result.setMessages(rootParse.getMessages());
return result;
}
However required results available in OpenAPIDeserializer- ParseResult,, which is protected.
if SwaggerParseResult output gives or other way to get warnings and errors separately, that would be helpful.. People can use them whether the swagger is valid or not.
or
allow them ParseOption to disable warnings and just return errors.
I've been using the Swagger UI tool, but I was missing a "Refresh" button, to refresh the URL that once was used to fetch the OpenAPI spec. Instead, I had to go to "Import URL" and add the URL every time I made a change to the spec in the backend code.
I did try to see if a page refresh (F5) had any effect, but it didnt. So, I cloned the repo, and made some small changes for me to run locally. I was considering a PR for this, but I read this, and here is the issue first for ppl to comment on =)
Changes I made locally, that I can make into a PR if ppl want it:
refreshURL
function, that looks in window.localstorage for the 'url' and refreshes it if it is found. If there is no cached URL, it will call the importFromURL
instead, opening up the popup to enter URLimportFromURL
so that the URL is cached in window.localstorageClear editor
in function clearEditor
to also remove the url
from localStorageRefresh
and the Import from URL
optionsI am not a web dev or react dev, so I was unsure where to place the toast lib js file. Currently, it is inside the /dist
folder, so the index.html is modified like this:
<body>
<div id="swagger-editor"></div>
<!-- https://www.cssscript.com/super-simple-javascript-message-toaster-toast-js/#google_vignette -->
<script src="./dist/toast.min.js"> </script>
<script src="./dist/swagger-editor-bundle.js"> </script>
Please let me know if I should make a PR out of this, or not =)
Hi, how are you? I'm new here, so any comment will help me. Thanks in advance.
I'm trying to setup a Swagger container following the installation process. When I start the container in the basic way, I can access the Petstore API documentation on localhost:80. But, when I try to use the SWAGGER_JSON with the uber.json the Petstore API is still shown in localhost. I followed the tips from this previous issue #5213, but without success.
Here is the environment variables in docker showing the SWAGGER_JSON parameter is overwritten
docker exec -it distracted_greider /bin/sh
/ # printenv
BASE_URL=
SWAGGER_JSON=uber.json
HOSTNAME=261ba0107a21
SHLVL=1
PORT=8080
HOME=/root
PKG_RELEASE=1
TERM=xterm
NGINX_VERSION=1.23.3
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
NJS_VERSION=0.7.9
API_KEY=**None**
SWAGGER_JSON_URL=
PWD=/
docker run -p 80:8080 -e SWAGGER_JSON=uber.json -v foo:/bar swaggerapi/swagger-ui
The public static method mapper() like below is not thread safe. It appears that the "mapper" field is designed to be lazily initialized and only initialize once. But current implementation does not guarantee the mapper field is initialized only once. If we want the lazy and only once initialization semantic, we need to use double checked locking or simply synchronize the mapper() method, otherwise, the mapper has chance to be initialized multiple times.
current implementation:
private static ObjectMapper mapper;
public static ObjectMapper mapper() {
if (mapper == null) {
mapper = ObjectMapperFactory.createJson();
}
return mapper;
}
suggested implementation using double checked locking
public static ObjectMapper mapper() {
if (mapper == null) {
synchronized(Json.class) {
if (mapper == null) {
mapper = ObjectMapperFactory.createJson();
}
}
}
We detected an issue during the json deserialization using the Jackson library 2.11.2 version.
The enum classes generated with the swagger open API 3.0 generator plugin are causing Jackson to throw exception when trying to deserialize the json using Jackson library 2.10.x and above versions.
The issue is happening when a swagger yaml has a type declared with the enum type of Integer in the spec, and the generated code trying to deserialize the json.
I have created a PR #904 with a possible fix and tested it with different Java types on my machine. Kindly take a look and approve if you think it looks good.
sample yaml with an enum Integer:
Count:
type: Integer
enum:
- 1
- 2
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.