diff --git a/example3.rst b/example3.rst index d1752bd..884b85d 100644 --- a/example3.rst +++ b/example3.rst @@ -123,29 +123,29 @@ nested/main.yaml Boo: type: array items: - $ref: '#/definitions/BooItems' - BooItems: + $ref: '#/definitions/BooItem' + BooItem: type: object properties: foo: $ref: '#/definitions/Foo' user: - $ref: '#/definitions/BooItemsUser' + $ref: '#/definitions/BooItemUser' grouplist: - $ref: '#/definitions/BooItemsGrouplist' + $ref: '#/definitions/BooItemGrouplist' x-auto-generated: true - BooItemsGrouplist: + BooItemGrouplist: type: array items: - $ref: '#/definitions/BooItemsGrouplistItems' + $ref: '#/definitions/BooItemGrouplistItem' x-auto-generated: true - BooItemsGrouplistItems: + BooItemGrouplistItem: type: object properties: name: type: string x-auto-generated: true - BooItemsUser: + BooItemUser: type: object properties: name: diff --git a/swagger_bundler/postscript.py b/swagger_bundler/postscript.py index 469f287..acbcd3a 100644 --- a/swagger_bundler/postscript.py +++ b/swagger_bundler/postscript.py @@ -67,8 +67,8 @@ def full_name(self): def add_name(self, name): self.path.append(name.title()) - def add_array_items(self): - self.add_name("items") + def add_array_item(self): + self.add_name("item") def pop_name(self): self.path.pop() @@ -139,7 +139,7 @@ def on_array_has_items(self, data, ctx): if "$ref" in data["items"]: return data fullname = ctx.full_name() - ctx.add_array_items() + ctx.add_array_item() data["items"] = self._extract(data["items"], ctx) ctx.save_array(fullname, data["items"]) ctx.pop_name()