Created
June 21, 2017 16:15
-
-
Save BjRo/adb663affd832770db9a8949e2ecd93e to your computer and use it in GitHub Desktop.
XING One DSL example
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
object Address extends ApiDSL { | |
val t = ApiObjectType( | |
"Address", | |
"A standard container for representing an address", | |
interfaces(Addressable.t), | |
fields( | |
optionalApiField("city", StringType), | |
optionalApiField("province", StringType), | |
optionalApiField("street", StringType), | |
optionalApiField("zip", StringType), | |
optionalApiField("country", CountryCodesAlpha2.t) | |
) | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice! Consider wildcard-importing all the members from
ApiDSL
instead of inheriting from it. Inheritance in this case might be confusing for users ofAddress
if DSL methods are public.