@platformatic/sql-json-schema-mapper
Advanced tools
Comparing version 0.6.1 to 0.7.0
@@ -1,1 +0,1 @@ | ||
{"processes":{"8bb1690a-4b68-4b2f-b5b4-d07f1c6653ef":{"parent":"d0b88887-f0a9-4dd3-8907-67197d76b283","externalId":"test/simple.test.js","children":[]},"d0b88887-f0a9-4dd3-8907-67197d76b283":{"parent":null,"children":["8bb1690a-4b68-4b2f-b5b4-d07f1c6653ef"]}},"files":{"/Users/matteo/Repositories/platformatic/packages/sql-json-schema-mapper/index.js":["8bb1690a-4b68-4b2f-b5b4-d07f1c6653ef"]},"externalIds":{"test/simple.test.js":{"root":"8bb1690a-4b68-4b2f-b5b4-d07f1c6653ef","children":[]}}} | ||
{"processes":{"9197e367-8f93-4327-b88d-065b0d2086be":{"parent":null,"children":["f49b5f59-1b8a-4ec3-9304-1ab005b9b509"]},"f49b5f59-1b8a-4ec3-9304-1ab005b9b509":{"parent":"9197e367-8f93-4327-b88d-065b0d2086be","externalId":"test/simple.test.js","children":[]}},"files":{"/Users/matteo/Repositories/platformatic/packages/sql-json-schema-mapper/index.js":["f49b5f59-1b8a-4ec3-9304-1ab005b9b509"]},"externalIds":{"test/simple.test.js":{"root":"f49b5f59-1b8a-4ec3-9304-1ab005b9b509","children":[]}}} |
@@ -79,2 +79,6 @@ 'use strict' | ||
} | ||
/* istanbul ignore next */ | ||
if (field.enum) { | ||
properties[field.camelcase].enum = field.enum | ||
} | ||
} | ||
@@ -81,0 +85,0 @@ return { |
{ | ||
"name": "@platformatic/sql-json-schema-mapper", | ||
"version": "0.6.1", | ||
"version": "0.7.0", | ||
"description": "Map SQL entity to JSON schema", | ||
@@ -8,3 +8,3 @@ "main": "index.js", | ||
"type": "git", | ||
"url": "git+https://github.com/plaformatic/platformatic.git" | ||
"url": "git+https://github.com/platformatic/platformatic.git" | ||
}, | ||
@@ -14,7 +14,7 @@ "author": "Matteo Collina <hello@matteocollina.com>", | ||
"bugs": { | ||
"url": "https://github.com/plaformatic/platformatic/issues" | ||
"url": "https://github.com/platformatic/platformatic/issues" | ||
}, | ||
"homepage": "https://github.com/plaformatic/platformatic#readme", | ||
"homepage": "https://github.com/platformatic/platformatic#readme", | ||
"devDependencies": { | ||
"@platformatic/sql-mapper": "0.6.1", | ||
"@platformatic/sql-mapper": "0.7.0", | ||
"fastify": "^4.6.0", | ||
@@ -21,0 +21,0 @@ "snazzy": "^9.0.0", |
@@ -72,2 +72,7 @@ 'use strict' | ||
} | ||
try { | ||
await db.query(sql`DROP Type pagetype`) | ||
} catch { | ||
} | ||
} |
@@ -6,3 +6,3 @@ 'use strict' | ||
const fastify = require('fastify') | ||
const { clear, connInfo, isSQLite, isMariaDB } = require('./helper') | ||
const { clear, connInfo, isSQLite, isMariaDB, isPg } = require('./helper') | ||
const { mapSQLEntityToJSONSchema } = require('..') | ||
@@ -19,2 +19,11 @@ const { test } = t | ||
);`) | ||
} else if (isPg) { | ||
await db.query(sql`CREATE TYPE pagetype as enum ('blank', 'non-blank'); | ||
CREATE TABLE pages ( | ||
id SERIAL PRIMARY KEY, | ||
title VARCHAR(42) NOT NULL, | ||
metadata JSON, | ||
description TEXT, | ||
type pagetype | ||
);`) | ||
} else { | ||
@@ -25,3 +34,4 @@ await db.query(sql`CREATE TABLE pages ( | ||
metadata JSON, | ||
description TEXT | ||
description TEXT, | ||
type ENUM ('blank', 'non-blank') | ||
);`) | ||
@@ -65,3 +75,6 @@ } | ||
t.same(pageJsonSchema.required, ['title']) | ||
if (!isSQLite) { | ||
t.same(pageJsonSchema.properties.type, { type: 'string', nullable: true, enum: ['blank', 'non-blank'] }) | ||
} | ||
} | ||
}) |
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
23456
223
0
1