Skip to content

Commit

Permalink
feat: Document inheritance as an experimental feature. (#164)
Browse files Browse the repository at this point in the history
* 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
BenAuerDev authored Sep 26, 2024
1 parent a64ee1a commit f5b4b64
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/06-concepts/11-authentication/01-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ void run(List<String> args) async {
| **emailSignInFailureResetTime** | The reset period for email sign in attempts. Defaults to 5 minutes.| 5min |
| **userCanEditUserImage** | True if users can update their profile images.| true |
| **userCanEditUserName** | True if users can edit their user names. | true |
| **userCanEditFullName** | True if users can view their user name. | true |
| **userCanEditFullName** | True if users can view their user name. | false |
| **userCanSeeUserName** | True if users can view their user name. | true |
| **userCanSeeFullName** | True if users can view their full name. | true |
| **enableUserImages** | True if user images are enabled. | true |
Expand Down
50 changes: 50 additions & 0 deletions docs/06-concepts/18-experimental.md
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.
:::

0 comments on commit f5b4b64

Please sign in to comment.