openapi-typescript
Advanced tools
Comparing version 4.1.1 to 4.2.0
@@ -172,2 +172,5 @@ "use strict"; | ||
} | ||
if (parts[parts.length - 2] === "properties") { | ||
parts.splice(parts.length - 2, 1); | ||
} | ||
const [base, ...rest] = parts; | ||
@@ -174,0 +177,0 @@ return `${base}["${rest.join('"]["')}"]`; |
@@ -165,2 +165,5 @@ import fetch from "node-fetch"; | ||
} | ||
if (parts[parts.length - 2] === "properties") { | ||
parts.splice(parts.length - 2, 1); | ||
} | ||
const [base, ...rest] = parts; | ||
@@ -167,0 +170,0 @@ return `${base}["${rest.join('"]["')}"]`; |
{ | ||
"name": "openapi-typescript", | ||
"description": "Generate TypeScript types from Swagger OpenAPI specs", | ||
"version": "4.1.1", | ||
"version": "4.2.0", | ||
"engines": { | ||
@@ -6,0 +6,0 @@ "node": ">= 12.0.0", |
@@ -6,3 +6,3 @@ [![version(scoped)](https://img.shields.io/npm/v/openapi-typescript.svg)](https://www.npmjs.com/package/openapi-typescript) | ||
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section --> | ||
[![All Contributors](https://img.shields.io/badge/all_contributors-40-orange.svg?style=flat-square)](#contributors-) | ||
[![All Contributors](https://img.shields.io/badge/all_contributors-41-orange.svg?style=flat-square)](#contributors-) | ||
<!-- ALL-CONTRIBUTORS-BADGE:END --> | ||
@@ -252,2 +252,3 @@ | ||
<td align="center"><a href="https://www.mbelsky.com/"><img src="https://avatars.githubusercontent.com/u/3923527?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Max Belsky</b></sub></a><br /><a href="https://github.com/drwpow/openapi-typescript/commits?author=mbelsky" title="Code">💻</a> <a href="https://github.com/drwpow/openapi-typescript/issues?q=author%3Ambelsky" title="Bug reports">🐛</a></td> | ||
<td align="center"><a href="https://github.com/Peteck"><img src="https://avatars.githubusercontent.com/u/1520592?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Peter Bech</b></sub></a><br /><a href="https://github.com/drwpow/openapi-typescript/commits?author=Peteck" title="Code">💻</a> <a href="https://github.com/drwpow/openapi-typescript/issues?q=author%3APeteck" title="Bug reports">🐛</a></td> | ||
</tr> | ||
@@ -254,0 +255,0 @@ </table> |
@@ -223,4 +223,13 @@ import fetch from "node-fetch"; | ||
// References to properties of schemas like `#/components/schemas/Pet/properties/name` | ||
// requires the components to be wrapped in a `properties` object. But to keep | ||
// backwards compatibility we should instead just remove the `properties` part. | ||
// For us to recognize the `properties` part it simply has to be the second last. | ||
if (parts[parts.length - 2] === "properties") { | ||
parts.splice(parts.length - 2, 1); | ||
} | ||
// scenario 3: transform all $refs pointing back to root schema | ||
const [base, ...rest] = parts; | ||
return `${base}["${rest.join('"]["')}"]`; // transform other $refs to the root schema (including external refs that point back to the root schema) | ||
@@ -227,0 +236,0 @@ }); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
245885
3642
262