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

swagger2typescript

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

swagger2typescript - npm Package Compare versions

Comparing version 1.0.2 to 1.1.0

121

fixtures/all3dp-print-service.d.ts
export interface Offer {
materialConfigurationId : string;
price : {
net : number;
state : string;
hasPrice : boolean;
errorMsg : string;
currency : string;
shipping : number;
total : number;
tax : number;
}
price : Price;
}
export interface MaterialConfiguration extends Array<{

@@ -20,7 +12,7 @@ printingService : string;

description : string;
}
};
finish : {
name : string;
description : string;
}
};
materialConfigurationId : string;

@@ -30,9 +22,10 @@ finishGroup : {

description : string;
}
};
materialGroup : {
name : string;
description : string;
}
};
}> {
}
export interface Address {

@@ -43,2 +36,3 @@ lastName : string;

}
export interface Model {

@@ -55,8 +49,9 @@ modelId : string;

y : number;
}
};
volume : number;
}
};
unit : string;
filename : string;
}
export interface Price {

@@ -72,2 +67,3 @@ net : number;

}
export interface CartItem {

@@ -79,2 +75,3 @@ amount : number;

}
// The printing engine will download a 3d-model from any location (url)
export interface FetchModelParameters {

@@ -85,2 +82,4 @@ modelLocation : string;

}
// undefined
export interface GetOffersParameters {

@@ -100,21 +99,16 @@ modelId : string;

}
// Order
export interface CreateOrderWithStripeParameters {
configurations : {
totalPrice : number;
address : {
lastName : string;
firstName : string;
countryCode : string;
}
address : Address;
currency : string;
cartItems : {
amount : number;
modelId : string;
scale : number;
materialConfigurationId : string;
}[];
cartItems : CartItem[];
stripeToken : string;
promotionCode : string;
}
};
}
// Estimate prices based on basic 3d-model properties
export interface EstimateOffersParameters {

@@ -133,8 +127,14 @@ volume : number;

}
// undefined
export interface GetOrderStatusParameters {
orderId : string;
}
// Get 3d-model properties about all the models you have uploaded
export interface GetAllModelsParameters {
sessionToken : string;
}
// Get an offer (price) for a modell and a configuration
export interface GetOfferParameters {

@@ -150,2 +150,4 @@ modelId : string;

}
// Websocket api (private)
export interface SubscribeToNewOffersParameters {

@@ -158,20 +160,15 @@ modelId : string;

}
// Order
export interface CreateOrderWithPaypalParameters {
configurations : {
totalPrice : number;
address : {
lastName : string;
firstName : string;
countryCode : string;
}
address : Address;
currency : string;
cartItems : {
amount : number;
modelId : string;
scale : number;
materialConfigurationId : string;
}[];
cartItems : CartItem[];
promotionCode : string;
}
};
}
// Executes an Order
export interface OrderParameters {

@@ -181,18 +178,11 @@ configurations : {

totalPrice : number;
address : {
lastName : string;
firstName : string;
countryCode : string;
}
address : Address;
secretKey : string;
currency : string;
cartItems : {
amount : number;
modelId : string;
scale : number;
materialConfigurationId : string;
}[];
cartItems : CartItem[];
promotionCode : string;
}
};
}
// Get the structure of the materials
export interface GetMaterialConfigurationsParameters {

@@ -205,2 +195,4 @@ materialGroupFilter : string;

}
// Upload a new 3d model to the prining engine
export interface UploadModelParameters {

@@ -211,20 +203,15 @@ file : File;

}
// Get the prices for a shopping cart
export interface GetCartParameters {
configurations : {
address : {
lastName : string;
firstName : string;
countryCode : string;
}
address : Address;
currency : string;
countryCode : string;
configuration : {
amount : number;
modelId : string;
scale : number;
materialConfigurationId : string;
}[];
configuration : CartItem[];
promotionCode : string;
}
};
}
// Get basic informations about a model
export interface GetModelParameters {

@@ -234,2 +221,4 @@ modelId : string;

}
// Deletes a model
export interface DeleteModelParameters {

@@ -239,2 +228,4 @@ sessionToken : string;

}
// Change the commisson for the model
export interface ChangeModelParameters {

@@ -246,3 +237,3 @@ modelId : string;

commisson : number;
}
};
}

@@ -11,7 +11,4 @@ #!/usr/bin/env node

const deref = obj => {
let selectors = obj['$ref'].split('/');
selectors.shift();
return selectors.reduce((last, cur) => last[cur], root);
const referenceDef = obj => {
return obj['$ref'].split('/')[2];
};

@@ -22,3 +19,3 @@

const property = object.properties[propertyName];
return `${propertyName} : ${typeDefiniton(property)}`;
return `${propertyName} : ${typeDefiniton(property)};`;
}).join('\n') + '\n}';

@@ -32,3 +29,3 @@ };

const typeDefiniton = obj => {
if (obj['$ref']) return typeDefiniton(deref(obj));
if (obj['$ref']) return referenceDef(obj);
if (obj.schema) return typeDefiniton(obj.schema);

@@ -40,11 +37,11 @@

case 'string':
return `string;`;
return `string`;
case 'number':
return `number;`;
return `number`;
case 'boolean':
return `boolean;`;
return `boolean`;
case 'file':
return `File;`;
return `File`;
case 'array':
return arrayDef(obj) + '[];';
return arrayDef(obj) + '[]';
default:

@@ -65,3 +62,3 @@ throw new Error(`type ${obj.type} not expected, ${JSON.stringify(obj, null, ' ')}`)

}).join('\n');
}).join('\n\n');

@@ -81,7 +78,7 @@ const parameterDefinition = obj => {

const definition = method.parameters.map(param => parameterDefinition(param)).join('\n');
const definition = method.parameters.map(param => parameterDefinition(param)+';').join('\n');
return `export interface ${operationId}Parameters {\n${definition}}`;
}).join('\n');
}).join('\n');
return `// ${method.summary}\nexport interface ${operationId}Parameters {\n${definition}}`;
}).join('\n\n');
}).join('\n\n');

@@ -88,0 +85,0 @@

{
"name": "swagger2typescript",
"version": "1.0.2",
"version": "1.1.0",
"description": "Creates typescript definitions (.d.ts) based on a swagger definition-file",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1",
"prepublish": "babel index.js > dist.js"
},

@@ -9,0 +10,0 @@ "author": "Jonathan Häberle <jonathan.haeberle@gmail.com> (http://dreampulse.de/)",

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