Open magdiel01 opened 8 years ago
Hi, How are using this project?? Can you elaborate me, because I am new to php.
$ ./swagger2slate.phar convert ../swagger.json -o source/index.md
giving me the following
PHP Warning: file_get_contents(../swagger.json): failed to open stream: No such file or directory in phar:///home/Desktop/swagger2slate.phar/index.php on line 15 swagger version must be 2.0
@magdiel01 your Swagger definition fails validation, maybe that's it? Try
{
"swagger": "2.0",
"info": {
"title": "My First API",
"version": "0.1"
},
"paths": {
"/api/resource.json": {
"get": {
"parameters": [
{
"name": "body",
"description": "Measure value object that needs to be added.",
"required": true,
"schema": {
"type": "array",
"items": {}
},
"in": "body"
}
],
"responses": {
"200": {
"description": "An example resource"
}
}
}
}
},
"definitions": {}
}
Another (maintained) solution for converting Swagger (OpenAPI) to Slate is https://github.com/mermade/widdershins
@MikeRalphson It fails because when I pasted the text into this thread it loses the indentation, thanks for the recommended solution.
@magdiel01 no problem. It isn't just the indentation though (that's optional for JSON / Swagger) - I've changed
"name": "body",
"description": "Measure value object that needs to be added.",
"required": true,
"type": "array",
"items": {},
"paramType": "body"
to
"name": "body",
"description": "Measure value object that needs to be added.",
"required": true,
"schema": {
"type": "array",
"items": {}
},
"in": "body"
You can check a Swagger definition is a valid at http://bigstickcarpet.com/swagger-parser/www/index.html
"swagger2slate.phar/vendor/twig/twig/lib/Twig/Extension/Core.php on line 927"
{ "swagger": "2.0", "info": { "title": "My First API", "version": "0.1" }, "paths": { "/api/resource.json": { "get": { "parameters": [ { "name": "body", "description": "Measure value object that needs to be added.", "required": true, "type": "array", "items": {}, "paramType": "body" } ], "responses": { "200": { "description": "An example resource" } } } } }, "definitions": {} }