-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Document inheritance as an experimental feature. (#164)
* document experimental features and inheritance * refactor: move page to reference tab * refactor: improves experimental feats Moves warning underneath heading. changes wording of warning exchanges feature-options from list to table with description improves wording in inheritance-intro and info box * refactor: changes default for userCanEditFullName to false
- Loading branch information
1 parent
a64ee1a
commit f5b4b64
Showing
2 changed files
with
51 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Experimental features | ||
|
||
:::warning | ||
Experimental features should not be used in production environments, as their stability is uncertain and they may receive breaking changes in upcoming releases. | ||
::: | ||
|
||
"Experimental Features" are cutting-edge additions to Serverpod that are currently under development or testing. These features allow developers to explore new functionalities and provide feedback, helping shape the future of Serverpod. However, they may not be fully stable or complete and are subject to change. | ||
|
||
By default, experimental features are disabled. To opt into using them, include the `--experimental-features` flag when running the serverpod command: | ||
|
||
```bash | ||
$ serverpod generate --experimental-features=all | ||
``` | ||
|
||
The current options you can pass are: | ||
|
||
|**Feature**|Description| | ||
|:-----|:---| | ||
| **all** | Enables all available experimental features. | | ||
| **inheritance** | Allows using the `extends` keyword in your model files to create class hierarchies.| | ||
|
||
## Inheritance | ||
|
||
Inheritance allows you to define class hierarchies in your model files by sharing fields between parent and child classes, simplifying class structures and promoting consistency by avoiding duplicate field definitions. | ||
|
||
```yaml | ||
class: ParentClass | ||
fields: | ||
name: String | ||
``` | ||
```yaml | ||
class: ChildClass | ||
extends: ParentClass | ||
fields: | ||
int: age | ||
``` | ||
This will generate a class with both `name` and `age` field. | ||
|
||
```dart | ||
class ChildClass extends ParentClass { | ||
String name | ||
int age | ||
} | ||
``` | ||
|
||
:::info | ||
The `extends` keyword does not work for models with a `table` field. | ||
::: |