-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add documentation generation functionality #367
Changes from 9 commits
14ba506
586677b
1dedbd8
e29f95e
2c4e92c
1a31248
bafad87
a8babbc
36b2691
e68d669
7ab516c
71218c6
0ad18ed
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
# {{ type_name }} | ||
{% if schema.description %} | ||
|
||
{{ schema.description }} | ||
{% endif %} | ||
|
||
## Syntax | ||
|
||
To declare this entity in your AWS CloudFormation template, use the following syntax: | ||
|
||
### JSON | ||
|
||
<pre> | ||
{ | ||
"Type" : "{{ type_name }}", | ||
"Properties" : { | ||
{% if schema.properties %} | ||
{% for propname, prop in schema.properties.items() %} | ||
"<a href="#{{ propname.lower() }}" title="{{ propname }}">{{ propname }}</a>" : <i>{{ prop.jsontype }}</i>{% if not loop.last %},{% endif %} | ||
|
||
{% endfor %} | ||
{% endif %} | ||
} | ||
} | ||
</pre> | ||
|
||
### YAML | ||
|
||
<pre> | ||
Type: {{ type_name }} | ||
Properties: | ||
{% if schema.properties %} | ||
{% for propname, prop in schema.properties.items() %} | ||
<a href="#{{ propname.lower() }}" title="{{ propname }}">{{ propname }}</a>: <i>{{ prop.yamltype }}</i> | ||
{% endfor %} | ||
{% endif %} | ||
</pre> | ||
{% if schema.properties %} | ||
|
||
## Properties | ||
|
||
{% for propname, prop in schema.properties.items() %} | ||
#### {{ propname }} | ||
{% if prop.description %} | ||
|
||
{{ prop.description }} | ||
{% endif %} | ||
|
||
_Required_: {% if propname in schema.required %}Yes{% else %}No{% endif %} | ||
|
||
|
||
_Type_: {{ prop.longformtype }} | ||
{% if prop.allowedvalues %} | ||
|
||
_Allowed Values_: {% for allowedvalue in prop.allowedvalues %}<code>{{ allowedvalue }}</code>{% if not loop.last %} | {% endif %}{% endfor %} | ||
|
||
{% endif %} | ||
{% if prop.minLength %} | ||
|
||
_Minimum_: <code>{{ prop.minLength }}</code> | ||
{% endif %} | ||
{% if prop.maxLength %} | ||
|
||
_Maximum_: <code>{{ prop.maxLength }}</code> | ||
{% endif %} | ||
{% if prop.pattern %} | ||
|
||
_Pattern_: <code>{{ prop.pattern }}</code> | ||
{% endif %} | ||
{% if prop.createonly %} | ||
|
||
_Update requires_: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement) | ||
{% else %} | ||
|
||
_Update requires_: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt) | ||
{% endif %} | ||
Comment on lines
+70
to
+76
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we're generating documentation, it's probably worth noting nuance for something as important as potential resource replacement. For example, a version property might be upgradable in-place but not downgradable in-place, so neither of these definitions would be entirely accurate. My assumption would be while schema definitions like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
{% endfor %} | ||
{% endif %} | ||
{% if getatt or ref %} | ||
## Return Values | ||
{% if ref %} | ||
|
||
### Ref | ||
|
||
When you pass the logical ID of this resource to the intrinsic `Ref` function, Ref returns the {{ ref }}. | ||
{% endif %} | ||
{% if getatt %} | ||
|
||
### Fn::GetAtt | ||
|
||
The `Fn::GetAtt` intrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values. | ||
|
||
For more information about using the `Fn::GetAtt` intrinsic function, see [Fn::GetAtt](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-getatt.html). | ||
|
||
{% for att in getatt %} | ||
#### {{ att.name }} | ||
{% if att.description %} | ||
|
||
{{ att.description }} | ||
{% endif %} | ||
|
||
{% endfor %} | ||
{% endif %} | ||
{% endif %} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# {{ type_name }} {{ subproperty_name }} | ||
{% if schema.description %} | ||
|
||
{{ schema.description }} | ||
{% endif %} | ||
|
||
## Syntax | ||
|
||
To declare this entity in your AWS CloudFormation template, use the following syntax: | ||
|
||
### JSON | ||
|
||
<pre> | ||
{ | ||
{% if schema.properties %} | ||
{% for propname, prop in schema.properties.items() %} | ||
"<a href="#{{ propname.lower() }}" title="{{ propname }}">{{ propname }}</a>" : <i>{{ prop.jsontype }}</i>{% if not loop.last %},{% endif %} | ||
|
||
{% endfor %} | ||
{% endif %} | ||
} | ||
</pre> | ||
|
||
### YAML | ||
|
||
<pre> | ||
{% if schema.properties %} | ||
{% for propname, prop in schema.properties.items() %} | ||
<a href="#{{ propname.lower() }}" title="{{ propname }}">{{ propname }}</a>: <i>{{ prop.yamltype }}</i> | ||
{% endfor %} | ||
{% endif %} | ||
</pre> | ||
{% if schema.properties %} | ||
|
||
## Properties | ||
|
||
{% for propname, prop in schema.properties.items() %} | ||
#### {{ propname }} | ||
{% if prop.description %} | ||
|
||
{{ prop.description }} | ||
{% endif %} | ||
|
||
_Required_: {% if propname in schema.required %}Yes{% else %}No{% endif %} | ||
|
||
_Type_: {{ prop.longformtype }} | ||
{% if prop.allowedvalues %} | ||
|
||
_Allowed Values_: {% for allowedvalue in prop.allowedvalues %}<code>{{ allowedvalue }}</code>{% if not loop.last %} | {% endif %}{% endfor %} | ||
|
||
{% endif %} | ||
{% if prop.minLength %} | ||
|
||
_Minimum_: <code>{{ prop.minLength }}</code> | ||
{% endif %} | ||
{% if prop.maxLength %} | ||
|
||
_Maximum_: <code>{{ prop.maxLength }}</code> | ||
{% endif %} | ||
{% if prop.pattern %} | ||
|
||
_Pattern_: <code>{{ prop.pattern }}</code> | ||
{% endif %} | ||
{% if prop.createonly %} | ||
|
||
_Update requires_: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement) | ||
{% else %} | ||
|
||
_Update requires_: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt) | ||
{% endif %} | ||
|
||
{% endfor %} | ||
{% endif %} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"typeName": "AWS::Valid::TypeName", | ||
"description": "a test schema", | ||
"properties": { | ||
"property1": { | ||
"type": "string", | ||
"$ref": "#/definitions/invalid" | ||
} | ||
}, | ||
"primaryIdentifier": [ | ||
"/properties/property1" | ||
], | ||
"additionalProperties": false | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be
Integer
, right?