This package has been deprecated

    Author message:

    Specificator is deprecated in favor of https://github.com/kojidev/openapi-ts

    @flaksp/specificator-serializer
    TypeScript icon, indicating that this package has built-in type declarations

    0.2.0 • Public • Published

    Specificator serializer

    Coverage Status

    Achtung! This library is in early development state so it's unstable. It works now, but there are no guarantees for API stability (it may change during development). We are testing this library inside our projects and adopting some features to make it feel better. Please wait for version 1.0 and don't use it inside real projects.

    This library is default serializer for Specificator.

    Documentation

    Installation

    Install from npm Registry:

    npm install --save-dev @flaksp/specificator-serializer

    The package is also available in GitHub Package Registry.

    Usage

    Simple example:

    import {Serializer} from "specificator-serializer";
    import {Contact, Info, License, OpenAPI} from "specificator";
     
    const documentationSchema = new OpenAPI({
        info: new Info({
            contact: new Contact({
                email: "test@example.com",
                name: "Test name",
                url: "https://example.com/test",
            }),
            description: "Test description",
            license: new License({
                name: "Test license",
                url: "https://example.com/test",
            }),
            termsOfService: "https://example.com/test",
            title: "Test title",
            version: "1.0.0",
        }),
        paths: {},
    });
     
    const serializer = new Serializer();
     
    const serializedDocumentation = serializer.serialize(documentationSchema);
    const serializedDocumentationJson = JSON.stringify(serializedDocumentation);
     
    console.log(serializedDocumentationJson); // prints your documentation in JSON

    Configuration

    Serializer constructor accepts optional configuration object. Example:

    import {Serializer} from "specificator-serializer";
     
    const serializer = new Serializer({
        sortObjectKeysAlphabetically: true
    });

    Possible configuration parameters are listed below.

    sortObjectKeysAlphabetically

    Boolean. Sort all object keys alphabetically. Defaults to false.

    Install

    npm i @flaksp/specificator-serializer

    DownloadsWeekly Downloads

    4

    Version

    0.2.0

    License

    MIT

    Unpacked Size

    9.03 kB

    Total Files

    9

    Last publish

    Collaborators

    • avatar