nuagenetworks / monolithe

generic and extendable code generator from specifications.
BSD 3-Clause "New" or "Revised" License
16 stars 28 forks source link

Subtype JSON, and entityName changes #153

Closed killanch closed 4 years ago

killanch commented 4 years ago

Sample generated file:

import NUAttribute from 'service/NUAttribute';
import NUAbstractModel from 'service/NUAbstractModel';

/* Represents BandwidthTestResult entity
   Bandwidth Test Result
*/
export default class NUBandwidthTestResult extends NUAbstractModel {
    constructor(...args) {
        super(...args);
        this.defineProperties({
            entityName: 'bandwidthtestresult',
            bandwidth: undefined,
            retries: undefined,
        });
    }

    static entityDescriptor = {
        description: `Bandwidth Test Result`,
        userlabel: `Bandwidth Test Result`,
    }

    static attributeDescriptors = {
        bandwidth: new NUAttribute({
            localName: 'bandwidth',
            attributeType: NUAttribute.ATTR_TYPE_FLOAT,
            description: `The average bandwidth of the test in Mb/s`,
            canOrder: true,
            canSearch: true,
            userlabel: `Bandwidth Mb/s`,
        }),
        retries: new NUAttribute({
            localName: 'retries',
            attributeType: NUAttribute.ATTR_TYPE_INTEGER,
            description: `The number of retries`,
            canOrder: true,
            canSearch: true,
            userlabel: `Retries`,
            minValue: 0,
            maxValue: 2147483647,
        }),
    }

    static getClassName() {
        return 'NUBandwidthTestResult';
    }

    getClassName() {
        return NUBandwidthTestResult.getClassName();
    }
}