Get pretty printed object prototype from the schema name. Args: name: string, Name of schema in the discovery document. seen: list of string, Names of schema already seen. Used to handle recursive definitions. Returns: string, A string that
(self, name, seen=None, dent=0)
| 85 | |
| 86 | @util.positional(2) |
| 87 | def _prettyPrintByName(self, name, seen=None, dent=0): |
| 88 | """Get pretty printed object prototype from the schema name. |
| 89 | |
| 90 | Args: |
| 91 | name: string, Name of schema in the discovery document. |
| 92 | seen: list of string, Names of schema already seen. Used to handle |
| 93 | recursive definitions. |
| 94 | |
| 95 | Returns: |
| 96 | string, A string that contains a prototype object with |
| 97 | comments that conforms to the given schema. |
| 98 | """ |
| 99 | if seen is None: |
| 100 | seen = [] |
| 101 | |
| 102 | if name in seen: |
| 103 | # Do not fall into an infinite loop over recursive definitions. |
| 104 | return "# Object with schema name: %s" % name |
| 105 | seen.append(name) |
| 106 | |
| 107 | if name not in self.pretty: |
| 108 | self.pretty[name] = _SchemaToStruct( |
| 109 | self.schemas[name], seen, dent=dent |
| 110 | ).to_str(self._prettyPrintByName) |
| 111 | |
| 112 | seen.pop() |
| 113 | |
| 114 | return self.pretty[name] |
| 115 | |
| 116 | def prettyPrintByName(self, name): |
| 117 | """Get pretty printed object prototype from the schema name. |
no test coverage detected