OpenAPI 2.0 (Swagger 2.0) Documentation from Text. Built by your friends at Dynamic APIs.
This project uses the GNU GPLv3 License. Permissions of this strong copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights.
To enable the widest possible usage of the OpenAPI 2.0 Document Specification through a post build process and using specific markup. By default the application will look within code comments. If you are using a Dynamic APIs documentation portal you can simply upload your output file to your portal, or use our LightHouse product to grab the json from a hosted environment.
To simplify the initial release, markup is collected TOP DOWN. Just remember to keep the order.
/*
--security definition for the api endpoint specifed in the subsequent route
[SwaggerSecurityDefinition(Type = "oauth2", Flow = "implicit", AuthorizationUrl = "https://login.salesforce.com/services/oauth2/token", Scopes = [{ "readAccess", "Access read operations" }, { "writeAccess", "Access write operations" }])]
--the route definition
[SwaggerRoute("/api/v1/resource/")]
--the route operation
[SwaggerOperation(Verb = "POST", Summary = "Creates the resource", Description = "Performs the creation of a resource", OperationId = "DoWork1", Tags = ["DoWork"], Consumes = ["application/json"], Produces = ["application/json"]]
--the route input properties
[SwaggerInput(InputType = "QueryString", SwaggerParameter(Name = "isTest", Type = "Boolean", Description = "Indicates if the request is a test", Required = false))]
--the route input properties
[SwaggerInput(InputType = "Body", SwaggerParameter(Name = "RequestBody", Type = "Map<String, String>", Description = "The data", Required = true))]
--the route response
[SwaggerResponse(HttpStatusCode = 200, Description = "The asynchronous request was successful", Type = "Response_v1")]
--the route response
[SwaggerResponse(HttpStatusCode = 201, Description = "The syncchronous request was successful", Type = "Response_v1")]
--the route response
[SwaggerResponse(HttpStatusCode = 500, Description = "Internal Server Error", Type = "")]
--the route response header
[SwaggerResponseHeader(HttpStatusCode = 500, Description = "Error Code", Key = "x-error-code", Value = "200.1")]
--the route response header
[SwaggerResponseHeader(HttpStatusCode = 500, Description = "Error Description", Key = "x-error-description", Value = "details about the error")]
--the route response header
[SwaggerResponseHeader(HttpStatusCode = 500, Description = "Error Line Number", Key = "x-error-linenumber", Value = "the line number associated to the error")]
--the route response
[SwaggerResponse(HttpStatusCode = 500, Description = "General Failure", Type = "null")]
--the route response header
[SwaggerResponseHeader(HttpStatusCode = 500, Description = "Error Code", Key = "x-error-code", Value = "200.0")]
--the route response header
[SwaggerResponseHeader(HttpStatusCode = 500, Description = "Error Description", Key = "x-error-description", Value = "details about the error")]
--the route response header
[SwaggerResponseHeader(HttpStatusCode = 500, Description = "Error Line Number", Key = "x-error-linenumber", Value = "the line number associated to the error")]
--the response object
[SwaggerObject(Type = "Response_v1", Name = "Response_v1", Description = "The response v1")]
--the response object property
[SwaggerObjectProperty(Type = "Boolean", Name = "isSuccessful", Description = "Specifies if the response was successful or not", Required = false)]
--the response object property
[SwaggerObjectProperty(Type = "String", Name = "messages", Description = "Messages associated to this response", Required = false)]
--the response object property
[SwaggerObjectProperty(Type = "Boolean", Name = "isAsync", Description = "Specifies if the request associated to this response was performed Asynchronously or Syncronously", Required = false)]
*/
Pre-Requisite: You are required to have a JDK installed on the system in order to use the built application. From *nix
$ ~/directory-with-files> java openapift -codecomments true -input . -output openapidoc.json
From Windows
C:\directory-with-files> javac openapift.java -codecomments true -input . -output openapidoc.json
Brought to you by your friends at Dynamic APIs
