diff --git a/dist/bundle.umd.min.js b/dist/bundle.umd.min.js index c4d89ff3a7ee3bb434b35695297d2062d700f8f2..5d71ca4888665c4062b0a8747a6af526d494e750 100644 Binary files a/dist/bundle.umd.min.js and b/dist/bundle.umd.min.js differ diff --git a/dist/index.esm.js b/dist/index.esm.js index 8aab5fe752f920ca0742812513a3e717930ea9af..966ade9ba3a25ae099a2a8f92167c58177a78d6e 100644 Binary files a/dist/index.esm.js and b/dist/index.esm.js differ diff --git a/dist/index.js b/dist/index.js index 8d05375d63a343539b2121754898e26149998a1a..251ab3cd00e9268a98634057fdd2b04ed7e267b9 100644 Binary files a/dist/index.js and b/dist/index.js differ diff --git a/dist/index.umd.js b/dist/index.umd.js index 149b6ef75ff23c141d7f6662e404953cd9e39e99..b9e90303f59d071321c7f63ab4e132823898ef46 100644 Binary files a/dist/index.umd.js and b/dist/index.umd.js differ diff --git a/dist/index.umd.min.js b/dist/index.umd.min.js index ea5aa55bdb7ffe8b9724f3931df524e9d9a0fcec..1766def64ae4bb2e9ec8d354d78b3f4f3a2f56d7 100644 Binary files a/dist/index.umd.min.js and b/dist/index.umd.min.js differ diff --git a/dist/index.umd.min.js.map b/dist/index.umd.min.js.map index cd29ca7a5e9c53f9c491b3f1538f9f60bb7d465d..c33f69cb5f57837d4902d0b6333d5462dea99960 100644 Binary files a/dist/index.umd.min.js.map and b/dist/index.umd.min.js.map differ diff --git a/src/generators/coreFormat.js b/src/generators/coreFormat.js index 4ffccc84fa89c80135ca47e37fa1e344870fbd11..5d5003c8518dd33270ca50da478bfece7087168f 100644 --- a/src/generators/coreFormat.js +++ b/src/generators/coreFormat.js @@ -21,7 +21,7 @@ const regexps = { 'json-pointer': `(/(?:${FRAGMENT.replace(']*', '/]*')}|~[01]))+`, // some types from https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#data-types (?) - uuid: '^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$', + uuid: '[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$', }; regexps.iri = regexps['uri-reference']; diff --git a/tests/schema/core/formats.json b/tests/schema/core/formats.json index 462080be918559f8e29cd9bc98cdd90862a7e739..a3d80072d09287c072ef449033c8cbc8f16bc48c 100644 --- a/tests/schema/core/formats.json +++ b/tests/schema/core/formats.json @@ -25,6 +25,14 @@ "format": "time" }, "type": "string" + }, + { + "description": "should handle uuid", + "schema": { + "type": "string", + "format": "uuid" + }, + "type": "string" } ] } diff --git a/tests/unit/generators/coreFormat.spec.js b/tests/unit/generators/coreFormat.spec.js new file mode 100644 index 0000000000000000000000000000000000000000..26dd7d52f75def428b97ab9339eda71e43afa364 --- /dev/null +++ b/tests/unit/generators/coreFormat.spec.js @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import coreFormatGenerator from '../../../src/generators/coreFormat'; + +/* global describe, it */ + +describe('coreFormat Generator', () => { + describe('uuid', () => { + it('should always match uuid regex', () => { + expect(coreFormatGenerator('uuid')).to.match(/[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/); + }); + + it('should not be presented in the form of UUID as a URN', () => { + expect(coreFormatGenerator('uuid')).to.not.include('urn:uuid'); + }); + }); +});