-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #578 from jvalue/document-publish-use-feature
Document publish use feature
- Loading branch information
Showing
3 changed files
with
93 additions
and
67 deletions.
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
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,78 @@ | ||
// SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg | ||
// | ||
// SPDX-License-Identifier: AGPL-3.0-only | ||
|
||
// This file belongs to example 2: Electric Vehicles | ||
// Learning goals: | ||
// - Understand how to publish elements to use them in other files | ||
|
||
// 1. The publish keyword can be used directly when defining an element. | ||
publish valuetype UsStateCode oftype text { | ||
constraints: [ | ||
UsStateCodeAllowlist, | ||
]; | ||
} | ||
|
||
// 2. The publish keyword can be used after a definition as well (see below). | ||
// When using this delayed publish syntax, the published element can also be renamed. Doing so will make it available using the changed name whenever it is imported with the `use` syntax in another file. | ||
constraint UsStateCodeAllowlist on text: value in [ | ||
"AL", | ||
"AK", | ||
"AZ", | ||
"AR", | ||
"AS", | ||
"CA", | ||
"CO", | ||
"CT", | ||
"DE", | ||
"DC", | ||
"FL", | ||
"GA", | ||
"GU", | ||
"HI", | ||
"ID", | ||
"IL", | ||
"IN", | ||
"IA", | ||
"KS", | ||
"KY", | ||
"LA", | ||
"ME", | ||
"MD", | ||
"MA", | ||
"MI", | ||
"MN", | ||
"MS", | ||
"MO", | ||
"MT", | ||
"NE", | ||
"NV", | ||
"NH", | ||
"NJ", | ||
"NM", | ||
"NY", | ||
"NC", | ||
"ND", | ||
"MP", | ||
"OH", | ||
"OK", | ||
"OR", | ||
"PA", | ||
"PR", | ||
"RI", | ||
"SC", | ||
"SD", | ||
"TN", | ||
"TX", | ||
"TT", | ||
"UT", | ||
"VT", | ||
"VA", | ||
"VI", | ||
"WA", | ||
"WV", | ||
"WI", | ||
"WY", | ||
]; | ||
|
||
publish UsStateCodeAllowlist as UsStateCodeConstraint; |