Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@eropple/fastify-openapi3

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@eropple/fastify-openapi3 - npm Package Compare versions

Comparing version 0.3.1 to 0.3.2

test/typebox-ext.ts

2

dist/spec-transforms/find.js

@@ -13,3 +13,3 @@ import { TypeGuard } from "@sinclair/typebox/guard";

// but it does add time to plugin startup.
if (isFalsy(s.type)) {
if (isFalsy(s.type) && !s.allOf && !s.anyOf && !s.oneOf) {
throw new Error(`Schema object has no type: ${JSON.stringify(s)}`);

@@ -16,0 +16,0 @@ }

{
"name": "@eropple/fastify-openapi3",
"version": "0.3.1",
"version": "0.3.2",
"author": "Ed Ropple",

@@ -5,0 +5,0 @@ "license": "LGPL-3.0",

@@ -34,3 +34,3 @@ import {

// but it does add time to plugin startup.
if (isFalsy(s.type)) {
if (isFalsy(s.type) && !s.allOf && !s.anyOf && !s.oneOf) {
throw new Error(`Schema object has no type: ${JSON.stringify(s)}`);

@@ -37,0 +37,0 @@ }

@@ -10,2 +10,3 @@ import { OpenAPIObject, OperationObject, SchemaObject } from 'openapi3-ts';

import { APPLICATION_JSON, SCHEMA_NAME_PROPERTY } from '../src/constants.js';
import { UnionOneOf } from './typebox-ext.js';

@@ -27,2 +28,6 @@ const typeA = schemaType('MyTypeA', Type.Object({}));

const oneOfType = schemaType('OneOfType', UnionOneOf([
Type.Literal('a'),
Type.Literal('b'),
]));

@@ -152,3 +157,3 @@ const baseOas: OpenAPIObject = {

test('finds nested tagged schema', () => {
test('finds nested tagged schema in objects', () => {
const oas: OpenAPIObject = {

@@ -169,3 +174,3 @@ ...baseOas,

test('finds tagged schema in arrays', () => {
test('finds nested tagged schema in arrays', () => {
const oas: OpenAPIObject = {

@@ -186,2 +191,18 @@ ...baseOas,

test('correctly finds oneOf/anyOf schemas (despite not having types)', () => {
const oas: OpenAPIObject = {
...baseOas,
components: {
schemas: {
'OneOfType': oneOfType,
}
}
};
const schemaKeys = [
...new Set([...findTaggedSchemas(oas).map(s => s[SCHEMA_NAME_PROPERTY])]),
];
expect(schemaKeys).toHaveLength(1);
});
// TODO: test for callback

@@ -188,0 +209,0 @@ // I'm confident it works (as it duplicates request body syntax), but we should have

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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