New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@platformatic/sql-json-schema-mapper

Package Overview
Dependencies
Maintainers
5
Versions
331
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@platformatic/sql-json-schema-mapper - npm Package Compare versions

Comparing version 0.8.0 to 0.9.0

.nyc_output/758081ea-bea3-4057-9ffe-d39ca896e75c.json

2

.nyc_output/processinfo/index.json

@@ -1,1 +0,1 @@

{"processes":{"77a51ed1-28eb-4f3a-81ac-882440355c34":{"parent":"e67c9e41-1f24-460e-9d74-6a0d2ffd0c2f","externalId":"test/simple.test.js","children":[]},"e67c9e41-1f24-460e-9d74-6a0d2ffd0c2f":{"parent":null,"children":["77a51ed1-28eb-4f3a-81ac-882440355c34"]}},"files":{"/Users/matteo/Repositories/platformatic/packages/sql-json-schema-mapper/index.js":["77a51ed1-28eb-4f3a-81ac-882440355c34"]},"externalIds":{"test/simple.test.js":{"root":"77a51ed1-28eb-4f3a-81ac-882440355c34","children":[]}}}
{"processes":{"758081ea-bea3-4057-9ffe-d39ca896e75c":{"parent":null,"children":["92438563-64d7-498c-bcea-54ec448f5406"]},"92438563-64d7-498c-bcea-54ec448f5406":{"parent":"758081ea-bea3-4057-9ffe-d39ca896e75c","externalId":"test/simple.test.js","children":[]}},"files":{"/Users/matteo/Repositories/platformatic/packages/sql-json-schema-mapper/index.js":["92438563-64d7-498c-bcea-54ec448f5406"]},"externalIds":{"test/simple.test.js":{"root":"92438563-64d7-498c-bcea-54ec448f5406","children":[]}}}

@@ -56,3 +56,3 @@ 'use strict'

function mapSQLEntityToJSONSchema (entity) {
function mapSQLEntityToJSONSchema (entity, ignore = {}) {
const fields = entity.fields

@@ -63,2 +63,5 @@ const properties = {}

const field = fields[name]
if (ignore[name] === true) {
continue
}
const type = mapSQLTypeToOpenAPIType(field.sqlType)

@@ -65,0 +68,0 @@ /* istanbul ignore next */

{
"name": "@platformatic/sql-json-schema-mapper",
"version": "0.8.0",
"version": "0.9.0",
"description": "Map SQL entity to JSON schema",

@@ -17,3 +17,3 @@ "main": "index.js",

"devDependencies": {
"@platformatic/sql-mapper": "0.8.0",
"@platformatic/sql-mapper": "0.9.0",
"fastify": "^4.6.0",

@@ -20,0 +20,0 @@ "snazzy": "^9.0.0",

@@ -77,1 +77,43 @@ 'use strict'

})
test('ignore one field', async (t) => {
const { pass, teardown } = t
const app = fastify()
app.register(sqlMapper, {
...connInfo,
async onDatabaseLoad (db, sql) {
pass('onDatabaseLoad called')
await clear(db, sql)
await createBasicPages(db, sql)
}
})
teardown(app.close.bind(app))
await app.ready()
{
const page = app.platformatic.entities.page
const pageJsonSchema = mapSQLEntityToJSONSchema(page, {
title: true
})
t.equal(pageJsonSchema.$id, 'Page')
t.equal(pageJsonSchema.title, 'Page')
t.equal(pageJsonSchema.description, 'A Page')
t.equal(pageJsonSchema.type, 'object')
t.same(pageJsonSchema.properties.id, { type: 'integer' })
t.equal(pageJsonSchema.properties.title, undefined)
t.same(pageJsonSchema.properties.description, { type: 'string', nullable: true })
if (isMariaDB) {
t.same(pageJsonSchema.properties.metadata, { type: 'string', nullable: true })
} else {
t.same(pageJsonSchema.properties.metadata, { type: 'object', additionalProperties: true, nullable: true })
}
t.same(pageJsonSchema.required, [])
if (!isSQLite) {
t.same(pageJsonSchema.properties.type, { type: 'string', nullable: true, enum: ['blank', 'non-blank'] })
}
}
})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc