diff --git a/src/Mpociot/ApiDoc/Generators/AbstractGenerator.php b/src/Mpociot/ApiDoc/Generators/AbstractGenerator.php index 4c649100..20add4e0 100644 --- a/src/Mpociot/ApiDoc/Generators/AbstractGenerator.php +++ b/src/Mpociot/ApiDoc/Generators/AbstractGenerator.php @@ -267,7 +267,8 @@ protected function parseRule($rule, $ruleName, &$attributeData, $seed) break; case 'in': $attributeData['description'][] = Description::parse($rule)->with($this->fancyImplode($parameters, ', ', ' or '))->getDescription(); - $attributeData['value'] = $faker->randomElement($parameters); +// $attributeData['value'] = $faker->randomElement($parameters); + $attributeData['value'] = $parameters[0]; break; case 'not_in': $attributeData['description'][] = Description::parse($rule)->with($this->fancyImplode($parameters, ', ', ' or '))->getDescription(); diff --git a/src/resources/views/partials/info.blade.php b/src/resources/views/partials/info.blade.php index 4ac1470e..07042e40 100644 --- a/src/resources/views/partials/info.blade.php +++ b/src/resources/views/partials/info.blade.php @@ -2,5 +2,5 @@ Welcome to the generated API reference. @if($showPostmanCollectionButton) -[Get Postman Collection]({{url($outputPath.'/collection.json')}}) +[Get Postman Collection]({{url(env('APP_DOCS_URL', env('APP_URL', '')).'/'.$outputPath.'/collection.json')}}) @endif \ No newline at end of file diff --git a/src/resources/views/partials/route.blade.php b/src/resources/views/partials/route.blade.php index 0102cc63..ce5f4a2e 100644 --- a/src/resources/views/partials/route.blade.php +++ b/src/resources/views/partials/route.blade.php @@ -10,10 +10,10 @@ > Example request: ```bash -curl -X {{$parsedRoute['methods'][0]}} "{{config('app.docs_url') ?: config('app.url')}}/{{$parsedRoute['uri']}}" \ --H "Accept: application/json"@if(count($parsedRoute['parameters'])) \ +curl -X {{$parsedRoute['methods'][0]}} {{$parsedRoute['methods'][0] == 'GET' ? '-G ' : ''}}"{{config('app.docs_url') ?: config('app.url')}}/{{$parsedRoute['uri']}}" \ + -H "Accept: application/json"@if(count($parsedRoute['parameters'])) \ @foreach($parsedRoute['parameters'] as $attribute => $parameter) - -d "{{$attribute}}"="{{$parameter['value']}}" \ + -d "{{$attribute}}"="{{$parameter['value']}}" @if ($attribute == end($parsedRoute['parameters']))\@endif @endforeach @endif @@ -26,7 +26,7 @@ "url": "{{config('app.docs_url') ?: config('app.url')}}/{{$parsedRoute['uri']}}", "method": "{{$parsedRoute['methods'][0]}}", @if(count($parsedRoute['parameters'])) -"data": {!! str_replace(' ',' ',json_encode(array_combine(array_keys($parsedRoute['parameters']), array_map(function($param){ return $param['value']; },$parsedRoute['parameters'])), JSON_PRETTY_PRINT)) !!}, +"data": {!! str_replace('}', ' }', str_replace(' ',' ', json_encode(array_combine(array_keys($parsedRoute['parameters']), array_map(function($param){ return $param['value']; },$parsedRoute['parameters'])), JSON_PRETTY_PRINT))) !!}, @endif "headers": { "accept": "application/json" diff --git a/tests/Fixtures/index.md b/tests/Fixtures/index.md index 2f2effbd..24c687ec 100644 --- a/tests/Fixtures/index.md +++ b/tests/Fixtures/index.md @@ -30,8 +30,8 @@ It can also be multiple lines long. > Example request: ```bash -curl -X GET "http://localhost/api/test" \ --H "Accept: application/json" +curl -X GET -G "http://localhost/api/test" \ + -H "Accept: application/json" ``` ```javascript @@ -70,8 +70,8 @@ null > Example request: ```bash -curl -X GET "http://localhost/api/fetch" \ --H "Accept: application/json" +curl -X GET -G "http://localhost/api/fetch" \ + -H "Accept: application/json" ``` ```javascript diff --git a/tests/Fixtures/resource_index.md b/tests/Fixtures/resource_index.md index c0cc4451..b356f9a2 100644 --- a/tests/Fixtures/resource_index.md +++ b/tests/Fixtures/resource_index.md @@ -27,8 +27,8 @@ Welcome to the generated API reference. > Example request: ```bash -curl -X GET "http://localhost/api/user" \ --H "Accept: application/json" +curl -X GET -G "http://localhost/api/user" \ + -H "Accept: application/json" ``` ```javascript @@ -69,8 +69,8 @@ $.ajax(settings).done(function (response) { > Example request: ```bash -curl -X GET "http://localhost/api/user/create" \ --H "Accept: application/json" +curl -X GET -G "http://localhost/api/user/create" \ + -H "Accept: application/json" ``` ```javascript @@ -112,7 +112,7 @@ $.ajax(settings).done(function (response) { ```bash curl -X POST "http://localhost/api/user" \ --H "Accept: application/json" + -H "Accept: application/json" ``` ```javascript @@ -144,8 +144,8 @@ $.ajax(settings).done(function (response) { > Example request: ```bash -curl -X GET "http://localhost/api/user/{user}" \ --H "Accept: application/json" +curl -X GET -G "http://localhost/api/user/{user}" \ + -H "Accept: application/json" ``` ```javascript @@ -186,8 +186,8 @@ $.ajax(settings).done(function (response) { > Example request: ```bash -curl -X GET "http://localhost/api/user/{user}/edit" \ --H "Accept: application/json" +curl -X GET -G "http://localhost/api/user/{user}/edit" \ + -H "Accept: application/json" ``` ```javascript @@ -229,7 +229,7 @@ $.ajax(settings).done(function (response) { ```bash curl -X PUT "http://localhost/api/user/{user}" \ --H "Accept: application/json" + -H "Accept: application/json" ``` ```javascript @@ -264,7 +264,7 @@ $.ajax(settings).done(function (response) { ```bash curl -X DELETE "http://localhost/api/user/{user}" \ --H "Accept: application/json" + -H "Accept: application/json" ``` ```javascript