@php $isInput ??= true; $level ??= 0; @endphp @foreach($fields as $name => $field) @if($name === '[]') @php $description = "The request body is an array ({$field['type']}`)"; $description .= !empty($field['description']) ? ", representing ".lcfirst($field['description'])."." : '.'; if(count($field['__fields'])) $description .= " Each item has the following properties:"; @endphp {!! Parsedown::instance()->text($description) !!} @foreach($field['__fields'] as $subfieldName => $subfield) @if(!empty($subfield['__fields'])) @else
@component('scribe::components.field-details', [ 'name' => $subfieldName, 'fullName' => $subfield['name'], 'type' => $subfield['type'] ?? 'string', 'required' => $subfield['required'] ?? false, 'description' => $subfield['description'] ?? '', 'example' => $subfield['example'] ?? '', 'enumValues' => $subfield['enumValues'] ?? null, 'endpointId' => $endpointId, 'hasChildren' => false, 'component' => 'body', 'isInput' => $isInput, ]) @endcomponent
@endif @endforeach @elseif(!empty($field['__fields']))
@component('scribe::components.field-details', [ 'name' => $name, 'fullName' => $field['name'], 'type' => $field['type'] ?? 'string', 'required' => $field['required'] ?? false, 'description' => $field['description'] ?? '', 'example' => $field['example'] ?? '', 'enumValues' => $field['enumValues'] ?? null, 'endpointId' => $endpointId, 'hasChildren' => true, 'component' => 'body', 'isInput' => $isInput, ]) @endcomponent @foreach($field['__fields'] as $subfieldName => $subfield) @if(!empty($subfield['__fields'])) @else
@component('scribe::components.field-details', [ 'name' => $subfieldName, 'fullName' => $subfield['name'], 'type' => $subfield['type'] ?? 'string', 'required' => $subfield['required'] ?? false, 'description' => $subfield['description'] ?? '', 'example' => $subfield['example'] ?? '', 'enumValues' => $subfield['enumValues'] ?? null, 'endpointId' => $endpointId, 'hasChildren' => false, 'component' => 'body', 'isInput' => $isInput, ]) @endcomponent
@endif @endforeach
@else
@component('scribe::components.field-details', [ 'name' => $name, 'fullName' => $field['name'], 'type' => $field['type'] ?? 'string', 'required' => $field['required'] ?? false, 'description' => $field['description'] ?? '', 'example' => $field['example'] ?? '', 'enumValues' => $field['enumValues'] ?? null, 'endpointId' => $endpointId, 'hasChildren' => false, 'component' => 'body', 'isInput' => $isInput, ]) @endcomponent
@endif @endforeach