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

@effect/platform

Package Overview
Dependencies
Maintainers
3
Versions
377
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@effect/platform - npm Package Compare versions

Comparing version 0.66.1 to 0.66.2

67

dist/cjs/OpenApiJsonSchema.js

@@ -68,2 +68,24 @@ "use strict";

});
const removeDefaultJsonSchemaAnnotations = (jsonSchemaAnnotations, ast) => {
if (jsonSchemaAnnotations["title"] === ast.annotations[AST.TitleAnnotationId]) {
delete jsonSchemaAnnotations["title"];
}
if (jsonSchemaAnnotations["description"] === ast.annotations[AST.DescriptionAnnotationId]) {
delete jsonSchemaAnnotations["description"];
}
return jsonSchemaAnnotations;
};
const getASTJsonSchemaAnnotations = ast => {
const jsonSchemaAnnotations = getJsonSchemaAnnotations(ast);
switch (ast._tag) {
case "StringKeyword":
return removeDefaultJsonSchemaAnnotations(jsonSchemaAnnotations, AST.stringKeyword);
case "NumberKeyword":
return removeDefaultJsonSchemaAnnotations(jsonSchemaAnnotations, AST.numberKeyword);
case "BooleanKeyword":
return removeDefaultJsonSchemaAnnotations(jsonSchemaAnnotations, AST.booleanKeyword);
default:
return jsonSchemaAnnotations;
}
};
const pruneUndefinedKeyword = ps => {

@@ -135,3 +157,3 @@ const type = ps.type;

}
if (handleIdentifier && !AST.isTransformation(ast)) {
if (handleIdentifier && !AST.isTransformation(ast) && !AST.isRefinement(ast)) {
const identifier = getJSONIdentifier(ast);

@@ -196,28 +218,16 @@ if (Option.isSome(identifier)) {

case "StringKeyword":
{
return ast === AST.stringKeyword ? {
type: "string"
} : {
type: "string",
...getJsonSchemaAnnotations(ast)
};
}
return {
type: "string",
...getASTJsonSchemaAnnotations(ast)
};
case "NumberKeyword":
{
return ast === AST.numberKeyword ? {
type: "number"
} : {
type: "number",
...getJsonSchemaAnnotations(ast)
};
}
return {
type: "number",
...getASTJsonSchemaAnnotations(ast)
};
case "BooleanKeyword":
{
return ast === AST.booleanKeyword ? {
type: "boolean"
} : {
type: "boolean",
...getJsonSchemaAnnotations(ast)
};
}
return {
type: "boolean",
...getASTJsonSchemaAnnotations(ast)
};
case "BigIntKeyword":

@@ -408,3 +418,6 @@ throw new Error(getJSONSchemaMissingAnnotationErrorMessage(path, ast));

{
throw new Error(getJSONSchemaMissingAnnotationErrorMessage(path, ast));
if (AST.encodedBoundAST(ast) === ast) {
throw new Error(getJSONSchemaMissingAnnotationErrorMessage(path, ast));
}
return go(ast.from, $defs, true, path);
}

@@ -447,3 +460,3 @@ case "TemplateLiteral":

return {
...getJsonSchemaAnnotations(ast.to),
...getASTJsonSchemaAnnotations(ast.to),
...go(ast.from, $defs, true, path),

@@ -450,0 +463,0 @@ ...getJsonSchemaAnnotations(ast)

@@ -58,2 +58,24 @@ /**

});
const removeDefaultJsonSchemaAnnotations = (jsonSchemaAnnotations, ast) => {
if (jsonSchemaAnnotations["title"] === ast.annotations[AST.TitleAnnotationId]) {
delete jsonSchemaAnnotations["title"];
}
if (jsonSchemaAnnotations["description"] === ast.annotations[AST.DescriptionAnnotationId]) {
delete jsonSchemaAnnotations["description"];
}
return jsonSchemaAnnotations;
};
const getASTJsonSchemaAnnotations = ast => {
const jsonSchemaAnnotations = getJsonSchemaAnnotations(ast);
switch (ast._tag) {
case "StringKeyword":
return removeDefaultJsonSchemaAnnotations(jsonSchemaAnnotations, AST.stringKeyword);
case "NumberKeyword":
return removeDefaultJsonSchemaAnnotations(jsonSchemaAnnotations, AST.numberKeyword);
case "BooleanKeyword":
return removeDefaultJsonSchemaAnnotations(jsonSchemaAnnotations, AST.booleanKeyword);
default:
return jsonSchemaAnnotations;
}
};
const pruneUndefinedKeyword = ps => {

@@ -125,3 +147,3 @@ const type = ps.type;

}
if (handleIdentifier && !AST.isTransformation(ast)) {
if (handleIdentifier && !AST.isTransformation(ast) && !AST.isRefinement(ast)) {
const identifier = getJSONIdentifier(ast);

@@ -186,28 +208,16 @@ if (Option.isSome(identifier)) {

case "StringKeyword":
{
return ast === AST.stringKeyword ? {
type: "string"
} : {
type: "string",
...getJsonSchemaAnnotations(ast)
};
}
return {
type: "string",
...getASTJsonSchemaAnnotations(ast)
};
case "NumberKeyword":
{
return ast === AST.numberKeyword ? {
type: "number"
} : {
type: "number",
...getJsonSchemaAnnotations(ast)
};
}
return {
type: "number",
...getASTJsonSchemaAnnotations(ast)
};
case "BooleanKeyword":
{
return ast === AST.booleanKeyword ? {
type: "boolean"
} : {
type: "boolean",
...getJsonSchemaAnnotations(ast)
};
}
return {
type: "boolean",
...getASTJsonSchemaAnnotations(ast)
};
case "BigIntKeyword":

@@ -398,3 +408,6 @@ throw new Error(getJSONSchemaMissingAnnotationErrorMessage(path, ast));

{
throw new Error(getJSONSchemaMissingAnnotationErrorMessage(path, ast));
if (AST.encodedBoundAST(ast) === ast) {
throw new Error(getJSONSchemaMissingAnnotationErrorMessage(path, ast));
}
return go(ast.from, $defs, true, path);
}

@@ -437,3 +450,3 @@ case "TemplateLiteral":

return {
...getJsonSchemaAnnotations(ast.to),
...getASTJsonSchemaAnnotations(ast.to),
...go(ast.from, $defs, true, path),

@@ -440,0 +453,0 @@ ...getJsonSchemaAnnotations(ast)

{
"name": "@effect/platform",
"version": "0.66.1",
"version": "0.66.2",
"description": "Unified interfaces for common platform-specific services",

@@ -17,4 +17,4 @@ "license": "MIT",

"peerDependencies": {
"@effect/schema": "^0.74.0",
"effect": "^3.8.3"
"@effect/schema": "^0.74.1",
"effect": "^3.8.4"
},

@@ -21,0 +21,0 @@ "publishConfig": {

@@ -259,2 +259,29 @@ /**

const removeDefaultJsonSchemaAnnotations = (
jsonSchemaAnnotations: Annotations,
ast: AST.AST
): Annotations => {
if (jsonSchemaAnnotations["title"] === ast.annotations[AST.TitleAnnotationId]) {
delete jsonSchemaAnnotations["title"]
}
if (jsonSchemaAnnotations["description"] === ast.annotations[AST.DescriptionAnnotationId]) {
delete jsonSchemaAnnotations["description"]
}
return jsonSchemaAnnotations
}
const getASTJsonSchemaAnnotations = (ast: AST.AST): Annotations => {
const jsonSchemaAnnotations = getJsonSchemaAnnotations(ast)
switch (ast._tag) {
case "StringKeyword":
return removeDefaultJsonSchemaAnnotations(jsonSchemaAnnotations, AST.stringKeyword)
case "NumberKeyword":
return removeDefaultJsonSchemaAnnotations(jsonSchemaAnnotations, AST.numberKeyword)
case "BooleanKeyword":
return removeDefaultJsonSchemaAnnotations(jsonSchemaAnnotations, AST.booleanKeyword)
default:
return jsonSchemaAnnotations
}
}
const pruneUndefinedKeyword = (ps: AST.PropertySignature): AST.AST | undefined => {

@@ -337,3 +364,3 @@ const type = ps.type

}
if (handleIdentifier && !AST.isTransformation(ast)) {
if (handleIdentifier && !AST.isTransformation(ast) && !AST.isRefinement(ast)) {
const identifier = getJSONIdentifier(ast)

@@ -395,20 +422,8 @@ if (Option.isSome(identifier)) {

}
case "StringKeyword": {
return ast === AST.stringKeyword ? { type: "string" } : {
type: "string",
...getJsonSchemaAnnotations(ast)
}
}
case "NumberKeyword": {
return ast === AST.numberKeyword ? { type: "number" } : {
type: "number",
...getJsonSchemaAnnotations(ast)
}
}
case "BooleanKeyword": {
return ast === AST.booleanKeyword ? { type: "boolean" } : {
type: "boolean",
...getJsonSchemaAnnotations(ast)
}
}
case "StringKeyword":
return { type: "string", ...getASTJsonSchemaAnnotations(ast) }
case "NumberKeyword":
return { type: "number", ...getASTJsonSchemaAnnotations(ast) }
case "BooleanKeyword":
return { type: "boolean", ...getASTJsonSchemaAnnotations(ast) }
case "BigIntKeyword":

@@ -579,3 +594,6 @@ throw new Error(getJSONSchemaMissingAnnotationErrorMessage(path, ast))

case "Refinement": {
throw new Error(getJSONSchemaMissingAnnotationErrorMessage(path, ast))
if (AST.encodedBoundAST(ast) === ast) {
throw new Error(getJSONSchemaMissingAnnotationErrorMessage(path, ast))
}
return go(ast.from, $defs, true, path)
}

@@ -615,3 +633,3 @@ case "TemplateLiteral": {

return {
...getJsonSchemaAnnotations(ast.to),
...getASTJsonSchemaAnnotations(ast.to),
...go(ast.from, $defs, true, path),

@@ -618,0 +636,0 @@ ...getJsonSchemaAnnotations(ast)

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