Skip to content

Commit ee00687

Browse files
authored
Merge pull request #3118 from dunglas/fix_js-command
[JSON Schema] Fix command
2 parents d1e5080 + 3306949 commit ee00687

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/JsonSchema/SchemaFactory.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,11 @@ public function buildSchema(string $resourceClass, string $format = 'json', stri
7373
$version = $schema->getVersion();
7474
$definitionName = $this->buildDefinitionName($resourceClass, $format, $type, $operationType, $operationName, $serializerContext);
7575

76-
$method = (null !== $operationType && null !== $operationName) ? $resourceMetadata->getTypedOperationAttribute($operationType, $operationName, 'method') : 'GET';
76+
if (null === $operationType || null === $operationName) {
77+
$method = Schema::TYPE_INPUT === $type ? 'POST' : 'GET';
78+
} else {
79+
$method = $resourceMetadata->getTypedOperationAttribute($operationType, $operationName, 'method');
80+
}
7781

7882
if (Schema::TYPE_OUTPUT !== $type && !\in_array($method, ['POST', 'PATCH', 'PUT'], true)) {
7983
return $schema;

0 commit comments

Comments
 (0)