Skip to content

Commit 28fd89d

Browse files
authored
feat(schema-generator): add operations (#1475)
1 parent 5dea61e commit 28fd89d

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

schema-generator/configuration.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ This is useful when you need two entities to have more than one relation.
8383
Example:
8484

8585
```yaml
86+
types:
8687
Organization:
8788
properties:
8889
contactPoint: { range: Person, relationTableName: organization_contactPoint }
@@ -96,6 +97,7 @@ Override the guessed class hierarchy of a given type with this option.
9697
Example:
9798

9899
```yaml
100+
types:
99101
ImageObject:
100102
parent: Thing # Force the parent to be Thing instead of CreativeWork > MediaObject
101103
properties: ~
@@ -110,10 +112,27 @@ Force a class to be (or to not be) `abstract`.
110112
Example:
111113

112114
```yaml
115+
types:
113116
Person:
114117
abstract: true
115118
```
116119

120+
## Define Operations
121+
122+
API Platform operations can be added this way:
123+
124+
```yaml
125+
types:
126+
Person:
127+
operations:
128+
item:
129+
get:
130+
method: GET
131+
collection:
132+
get:
133+
route_name: get_person_collection
134+
```
135+
117136
## Forcing a Nullable Property
118137

119138
Force a property to be (or to not be) `nullable`.
@@ -128,7 +147,7 @@ Example:
128147
name: { nullable: false }
129148
```
130149

131-
The `@Assert\NotNull` constrain is automatically added.
150+
The `@Assert\NotNull` constraint is automatically added.
132151

133152
```php
134153
<?php
@@ -659,6 +678,9 @@ config:
659678
# If declaring a custom class, this will be the class from which properties type will be guessed
660679
guessFrom: Thing
661680
681+
# Operations for the class
682+
operations: []
683+
662684
# Import all existing properties
663685
allProperties: false
664686

0 commit comments

Comments
 (0)