Skip to content

Instantly share code, notes, and snippets.

@pivotaljohn
Created May 5, 2021 21:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pivotaljohn/5bbc35714245ac5f4c18b033372fc100 to your computer and use it in GitHub Desktop.
Save pivotaljohn/5bbc35714245ac5f4c18b033372fc100 to your computer and use it in GitHub Desktop.
working out the type information of `urlValue` type.
#@ load("@ytt:url", "url")
#@ load("@ytt:struct", "struct")
---
#@ def yamlfragment():
foo: bar
#@ end
yaml_fragment:
type: #@ "ytt.yamlfragment" or type(yamlfragment())
#@ x = url.parse("https://bob:secret@example.com")
url_value:
type: #@ "@ytt:url.URL" or type(x)
truth: #@ x == True
string: #@ str(x)
as_string: #@ x.string()
user:
username: #@ x.user.name
password: #@ x.user.password
struct_value:
type: #@ "ytt.struct" or type(x)
truth: #@ x == True
string: #@ str(x)
as_string: #@ x.string()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment