Skip to content

Commit 0bd3bf0

Browse files
committed
Add syntax highlighting
1 parent 97951c0 commit 0bd3bf0

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

README.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -146,21 +146,21 @@ swagger-to-ts handles parsing of Swagger files.
146146

147147
An example on how to use the `x-nullable` property to control if a property is optional:
148148

149-
```
150-
const getNullable = (d: { [key: string]: any }): boolean => {
151-
const nullable = d['x-nullable'];
152-
if (typeof nullable === 'boolean') {
153-
return nullable;
154-
}
155-
return true;
156-
};
157-
158-
const propertyMapper = (
159-
swaggerDefinition: Swagger2Definition,
160-
property: Property
161-
): Property => ({ ...property, optional: getNullable(swaggerDefinition) });
162-
163-
const output = swaggerToTS(swagger, { propertyMapper });
149+
```js
150+
const getNullable = (d: { [key: string]: any }): boolean => {
151+
const nullable = d['x-nullable'];
152+
if (typeof nullable === 'boolean') {
153+
return nullable;
154+
}
155+
return true;
156+
};
157+
158+
const propertyMapper = (swaggerDefinition: Swagger2Definition, property: Property): Property => ({
159+
...property,
160+
optional: getNullable(swaggerDefinition),
161+
});
162+
163+
const output = swaggerToTS(swagger, { propertyMapper });
164164
```
165165

166166
[glob]: https://www.npmjs.com/package/glob

0 commit comments

Comments
 (0)