Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
@ama-sdk/generator-sdk
Advanced tools
The SDK contains 2 different parts:
A main part of the SDK is automatically generated from a Swagger Spec. The following folders contain the generated code:
The Code can be regenerated by running the following command:
yo @ama-sdk/sdk:core
There are 2 places where we can add custom code:
You can extend a base model in 3 steps:
// src/models/base/<model name>/index.ts
export * from "../../core/<model name>";
# in .swagger-codegen-ignore
src/models/base/<model name>/index.ts
// src/models/core/<model name>/index.ts
export * from "./<model name>.ts";
export * from "./<model name>.reviver.ts";
// src/models/core/<model name>/<model name>.ts
import { <model name> as Base<model name> } from "../../base/<model name>/<model name>";
export interface <model name> extends BaseB<model name> {
// Additional fields
}
// src/models/core/<model name>/<model name>.reviver.ts
import { yourFunction } from "../../../helpers/<model name>";
import { revive<model name> as Base<model name> } from "../../base/<model name>/<model name>.reviver";
import { <model name> } from "./<model name>";
import {Reviver, utils} from "@ama-sdk/core";
export function revive<model name><T extends <model name> = <model name>>(data: any, dictionary?: any) {
// TODO: use BaseRevive<T> when ready
const revivedData: T | undefined = Base<model name>(data, dictionary) as T | undefined;
if (!revivedData) { return ; }
if (!revivedData.yourField) {
revivedData.yourField = yourFunction(revivedData);
}
return revivedData;
}
Some commands are provided to keep your SDK up-to-date.
yarn swagger:regen
You can build and run UT with:
yarn test
These are some of the available configurations using vendor extensions in the swagger spec
In order to add the timezone to your timestamp property you can add the x-date-timezone extension in your yaml, for example:
properties:
timestamp:
title: timestamp
description: >-
Timestamp when event is triggered. UTC time (server time), with a
format similar to yyyy-MM-ddThh:mm:ss.sTZD. Refer to the pattern
type: string
format: date-time
x-date-timezone:
description: If this vendor extension is present send dates with the timezone
pattern: >-
^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{1,3}([Z]|([+][0-9]{2}:?[0-9]{2}$))
example: '2013-12-31T19:20:30.45+01:00'
FAQs
Swagger specification SDK Generator by yeoman
The npm package @ama-sdk/generator-sdk receives a total of 317 weekly downloads. As such, @ama-sdk/generator-sdk popularity was classified as not popular.
We found that @ama-sdk/generator-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.