metamug / r2 Goto Github PK
View Code? Open in Web Editor NEWR2 is your REST API Server that can connect with your database and other APIs using simple resource configurations
R2 is your REST API Server that can connect with your database and other APIs using simple resource configurations
Instead of item=”true” we can put the name of the identifier. This will align this to open api 3.0 spec.
For example <Request item="action">
instead of <Request item="true" />
So open api url become to /resource/{action}
instead of /resource/{id}
Currently code generate json for open api 3.0.
But need to generate html pages for swagger documentation the way https://editor.swagger.io/ is doing it.
Xrequest print error:
Input XML
<Sql id="testres" ref="testresource" datasource="mysqltest" type="query" output="true"></Sql>
<XRequest id="members" method="GET" output="true"
url="https://us20.api.mailchimp.com/3.0/lists/bf104d20b3/members/">
<Header name="Authorization" value="apikey 261ced5c9403b344aa6eaf480d514853-us20"/>
</XRequest>
</Sql>
Erroneous jsp output:
<sql:query var="testres" dataSource="mysqltest">select * from movie
url="https://us20.api.mailchimp.com/3.0/lists/bf104d20b3/members/" value="apikey 261ced5c9403b344aa6eaf480d514853-us20"</sql:query>
<c:set target="${output}" property="testres" value="${pageScope['testres']}"/>
<m:xrequest var="members" method="GET" output="true">
<m:header name="Authorization"/>
</m:xrequest>
This will support
metamug/mason#150
Define param tag on the resource level, so that validations are not repeated in each of the Request tags.
Instead of generic 412 error, share the input validation details, like min length required 5, provided 2.
{
"message": "Unable to validate input parameters",
"error": "Client Error",
"status": 412
}
The below generate
<Text id="loc4">$[loc2]</Text>
<c:set var="loc4" scope="page" value="${loc2.rows[0].null}"/>
<c:set target="${output}" property="loc4" value="${pageScope['loc4']}"/>
The openapi json shows an extra "/" in the path which causes the swagger editor to break.
It is incorrect to send application/json Content-TYpe when the request method is GET, still the server should give valid json error instead of throwing this error. Or it should handle the error.
com.eclipsesource.json.ParseException: Unexpected end of input at 1:1
com.eclipsesource.json.JsonParser.error(JsonParser.java:490)
com.eclipsesource.json.JsonParser.expected(JsonParser.java:484)
com.eclipsesource.json.JsonParser.readValue(JsonParser.java:193)
com.eclipsesource.json.JsonParser.parse(JsonParser.java:152)
com.eclipsesource.json.JsonParser.parse(JsonParser.java:91)
com.eclipsesource.json.Json.parse(Json.java:295)
com.github.wnameless.json.flattener.JsonFlattener.(JsonFlattener.java:122)
com.github.wnameless.json.flattener.JsonFlattener.flattenAsMap(JsonFlattener.java:99)
com.metamug.mason.entity.request.JsonStrategy.(JsonStrategy.java:39)
com.metamug.mason.entity.request.RequestAdapter.create(RequestAdapter.java:52)
com.metamug.mason.Router.processRequest(Router.java:636)
com.metamug.mason.Router.doFilter(Router.java:606)
com.metamug.api.mason.filters.AnalyticFilter.doFilter(AnalyticFilter.java:251)
org.apache.catalina.filters.CorsFilter.handleNonCORS(CorsFilter.java:352)
org.apache.catalina.filters.CorsFilter.doFilter(CorsFilter.java:171)
org.apache.catalina.filters.ExpiresFilter.doFilter(ExpiresFilter.java:1226)
item="false" will be treated as an item request. Since item attribute has been changed from boolean to String.
Following tags will either loc2 or loc3.
<Sql id="loc2" limit="limit" when="empty $tz">
select name, lat, lon, timezone as 'tz' from city where name like '$q%' and timezone = 'Asia/Kolkata'
</Sql>
<Sql id="loc3" limit="limit" when="not empty $tz">
select name, lat, lon, timezone as 'tz' from city where name like '$q%' and timezone = $tz
</Sql>
private final String outputFolder = "/Users/anishhirlekar/parser-output";
try to put it in the project
you can make a folder in the project. where this can be printed
no need to hard code your computer's path, this will fail.
Fix the .travis.yml file to add all build information
https://travis-ci.org/github/metamug/openapi-rest-model/
<Sql id="q" output="non-empty">
select name, addr from directory
</Sql>
When parsing it is possible to check id duplicates under a single request tag.
<XRequest id="issue" method="GET" output="true" url="https://metamug.atlassian.net/rest/api/3/issue/$issueId">
Does not convert the $issueId variable into the respective jsp
Redirect to /login from / if not logged in
Add sidebar listing all the resources with editor on the right.
Add server info in open api json
Extra tag generated with default value -1. This can be caused due to limit attribute
<Param name="l" type="number" required="true" min="5" max="20" value="5"/>
<Sql id="loc" limit="l" >
select name, lat, lon from city where name like '$q%'
</Sql>
<m:param name="l" type="NUMBER" value="${mtgReq.params['l']}" max="20.0" min="5.0" defaultValue="5" isRequired="true"/>
<m:param name="l" value="${mtgReq.params['l']}" type="number" defaultValue="-1"/>
<sql:query var="loc" dataSource="${datasource}" maxRows="${mtgReq.params['l']}">select name, lat, lon from city where name like CONCAT(? ,'%')
<sql:param value="${mtgReq.params['q']}"/>
</sql:query>
Add UI screenshots in README on github
Swagger specs add tags to request level. So we need tag attribute on request tag or we can add description inside
the Request tag to support request level tags
https://swagger.io/docs/specification/grouping-operations-with-tags/
<Resource>
<Desc>
This resource is for customer operations
<Tag name="customer-operations" color="#CAFE00"/>
</Desc>
<Request>
<Desc>
This request performs operations for the customer.
<Tag name="customer-query" color="#00CAFE"/>
</Desc>
</Request>
</Resource>
Add the API webapp with its structure into the tomcat server.
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.