Skip to content
This repository has been archived by the owner on Sep 6, 2019. It is now read-only.

Commit

Permalink
DESIGNER-1875 Design Center OAS JSON Import Issue
Browse files Browse the repository at this point in the history
  • Loading branch information
lbauret committed Apr 11, 2018
1 parent d26f147 commit f26da42
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/oas20/oas20DefinitionConverter.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ class Oas20DefinitionConverter extends Converter {
model.schema = this._import(oasDef.schema);
}

if (oasDef.hasOwnProperty('example')) {
if (oasDef.hasOwnProperty('example') && oasDef.example) {
if (typeof oasDef.example === 'object' && !_.isArray(oasDef.example)) {
model.example = Oas20DefinitionConverter.importExample(oasDef.example);
} else {
Expand Down
9 changes: 9 additions & 0 deletions test/data/oas20-raml10/source/definition-null-example.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
swagger: '2.0'
info:
title: Petstore
version: '1'
definitions:
pet:
type: string
example: ~
paths: {}
6 changes: 6 additions & 0 deletions test/data/oas20-raml10/target/definition-null-example.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#%RAML 1.0
title: Petstore
version: 1
types:
pet:
type: string

0 comments on commit f26da42

Please sign in to comment.