Skip to content

Commit

Permalink
sdf rename
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed Jun 3, 2020
1 parent 6816734 commit 9568364
Show file tree
Hide file tree
Showing 6 changed files with 145 additions and 140 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ It uses the [jinja2](https://jinja.palletsprojects.com/en/2.11.x/) templates eng
- [Available Templates](#available-templates)
- [IoTivity Server](#iotivity-server)
- [PythonFlask](#pythonflask)
- [one-data-model](#one-data-model)
- [OAS2SDF](#oas2sdf)
- [SDF2OAS](#sdf2oas)
- [Jinja2 template information](#jinja2-template-information)

Expand Down Expand Up @@ -88,17 +88,17 @@ New templates can be added by:
- [more details on the template](/swagger2x/src/templates/PythonFlask)
- [folder](https://github.com/openconnectivityfoundation/swagger2x/tree/master/src/templates/PythonFlask)

##### one-data-model
##### OAS2SDF

- generates schemas files for One Data Model in Simple Data Format (SDF) language.
- generates schemas files for One Data Model in Semantic Definition Format (SDF) language.
- __NO OCF implemenation__
- [more details on the template](/swagger2x/src/templates/one-data-model)
- [folder](https://github.com/openconnectivityfoundation/swagger2x/tree/master/src/templates/one-data-model)
- more details on [One Data Model SDF Format](https://github.com/one-data-model/language)

##### SDF2OAS

- generates Open API Specification (2.0) files from SDF language (One Data Model).
- generates Open API Specification (2.0) files from Semantic Definition Format (SDF) language (One Data Model).
- __NO OCF implemenation__
- [more details on the template](/swagger2x/src/templates/SDF2OAS)
- [folder](https://github.com/openconnectivityfoundation/swagger2x/tree/master/src/templates/SDF2OAS)
Expand Down
54 changes: 27 additions & 27 deletions constructs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -183,69 +183,69 @@ typical usage:
{% endfor -%}
```

#### odm_return_path_info
#### sdf_return_path_info
Return ocf resource type name: OCF name, e.g. oic.r.grinderAppliance returns grinderAppliance or grinderApplianceResURI
param json_data: inputted resource type file
param returnType: "name" or "path" or "description"
return: if returnType: "name" - string formatted name: e.g. grinder returnType: "description" - returns the description property of the "get" path, returnType: "path" the path name, e.g. /GrinderResURI

typical usage:
```
"odmObject": {
"{{ odm_return_path_info(json_data, "name") }}": {
"name": "{{ odm_return_path_info(json_data, "name") }}",
"description": "{{ odm_return_path_info(json_data, "description") }}",
"odmProperty": {
{{odm_property_object(json_data, "top")}}
"sdfObject": {
"{{ sdf_return_path_info(json_data, "name") }}": {
"name": "{{ sdf_return_path_info(json_data, "name") }}",
"description": "{{ sdf_return_path_info(json_data, "description") }}",
"sdfProperty": {
{{sdf_property_object(json_data, "top")}}
}
}
}
```

#### odm_property_object
Take the property values from a resource type and reformat for odm
param json_data: odmProperty's json_data from resource type
#### sdf_property_object
Take the property values from a resource type and reformat for SDF
param json_data: sdfProperty's json_data from resource type
param level: "top" = top level, ignore filtered out types, "sub" = subsequent level, no filter required
return: json formatted string

typical usage:
```
"odmObject": {
"{{ odm_return_path_info(json_data, "name") }}": {
"name": "{{ odm_return_path_info(json_data, "name") }}",
"description": "{{ odm_return_path_info(json_data, "description") }}",
"odmProperty": {
{{odm_property_object(json_data, "top")}}
"sdfObject": {
"{{ sdf_return_path_info(json_data, "name") }}": {
"name": "{{ sdf_return_path_info(json_data, "name") }}",
"description": "{{ sdf_return_path_info(json_data, "description") }}",
"sdfProperty": {
{{sdf_property_object(json_data, "top")}}
}
}
}
```

#### odm_required_block_check
Return True/False if the odmRequired block should be populated
#### sdf_required_block_check
Return True/False if the sdfRequired block should be populated
:json_data: inputted resource type file
:return: True/False

typical usage:
```
{% if odm_required_block_check(json_data) is sameas True %}
{% if sdf_required_block_check(json_data) is sameas True %}
,
"odmRequired":
{{odm_required_object(json_data)}}
"sdfRequired":
{{sdf_required_object(json_data)}}
{% endif %}
```

#### odm_required_object
Return the required object block for one-data-model
#### sdf_required_object
Return the required object block for OAS2SDF
:param json_value: json object for resource type
:return: json formatted string for odm required block
:return: json formatted string for SDF required block

typical usage:
```
{% if odm_required_block_check(json_data) is sameas True %}
{% if sdf_required_block_check(json_data) is sameas True %}
,
"odmRequired":
{{odm_required_object(json_data)}}
"sdfRequired":
{{sdf_required_object(json_data)}}
{% endif %}
```

Expand Down
Loading

0 comments on commit 9568364

Please sign in to comment.