diff --git a/src/api/json/catalog.json b/src/api/json/catalog.json index e20d4778fb6..43b0fb95494 100644 --- a/src/api/json/catalog.json +++ b/src/api/json/catalog.json @@ -319,6 +319,15 @@ "fileMatch": [".asyncapi-tool"], "url": "https://raw.githubusercontent.com/asyncapi/website/master/scripts/tools/tools-schema.json" }, + { + "name": "Aurora Agile Meta-Framework", + "description": "Yaml schema for Aurora Agile Meta-Framework", + "fileMatch": ["*.aurora.yaml","*.aurora.yml"], + "url": "https://json.schemastore.org/aurora-1.0.json", + "versions": { + "1.0": "https://json.schemastore.org/aurora-1.0.json" + } + }, { "name": "Avro Avsc", "description": "Avro Schema Avsc file", diff --git a/src/schemas/json/aurora-1.0.json b/src/schemas/json/aurora-1.0.json new file mode 100644 index 00000000000..6584ba7d349 --- /dev/null +++ b/src/schemas/json/aurora-1.0.json @@ -0,0 +1,318 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Aurora Agile Meta Framework", + "description": "Make agile applications without technical debt", + "type": "object", + "required": [ + "boundedContextName", + "moduleName", + "moduleNames", + "aggregateName" + ], + "additionalProperties": false, + "properties": { + "version": { + "type": "string", + "description": "Schema version", + "default": "0.0.1" + }, + "boundedContextName": { + "type": "string", + "description": "The name of the bounded context, singular in kebab-case" + }, + "moduleName": { + "type": "string", + "description": "The name of the module, singular in kebab-case" + }, + "moduleNames": { + "type": "string", + "description": "The name of the module, plural in kebab-case" + }, + "aggregateName": { + "type": "string", + "description": "The name of the aggregateName, singular in PascalCase" + }, + "hasOAuth": { + "type": "boolean", + "description": "Enabled authentication for this module", + "default": false + }, + "hasTenant": { + "type": "boolean", + "description": "Enabled tenant for this module", + "default": false + }, + "hasAuditing": { + "type": "boolean", + "description": "Enabled auditing for this module", + "default": false + }, + "aggregateProperties": { + "type": "array", + "items": { + "$ref": "#/definitions/property" + } + }, + "aggregateI18nProperties": { + "type": "array", + "items": { + "$ref": "#/definitions/property" + } + }, + "additionalApis": { + "type": "array", + "items": { + "$ref": "#/definitions/apiDefinition" + } + } + }, + "definitions": { + "property": { + "type": "object", + "required": [ + "name", + "type" + ], + "additionalProperties": false, + "properties": { + "name": { + "type": "string", + "description": "The name of property, in camelCase" + }, + "type": { + "type": "string", + "description": "The type of property", + "enum": [ + "bigint.unsigned", + "bigint", + "blob.long", + "blob.medium", + "blob.tiny", + "blob", + "boolean", + "char", + "date", + "decimal", + "enum", + "float", + "id", + "int.unsigned", + "int", + "json", + "manyToMany", + "password", + "relationship", + "smallint.unsigned", + "smallint", + "text", + "timestamp", + "tinyint.unsigned", + "tinyint", + "varchar" + ] + }, + "length": { + "type": "number", + "description": "Set max length to property" + }, + "maxLength": { + "type": "number", + "description": "Set max length to property" + }, + "nullable": { + "type": "boolean", + "description": "Set property to nullable" + }, + "primaryKey": { + "type": "boolean", + "description": "Set property to primary key" + }, + "index": { + "type": "string", + "description": "To define property like a index", + "enum": [ + "index", + "unique" + ] + }, + "indexName": { + "type": "string", + "description": "The name of index, if there are various indexes with the same name, they will be grouped" + }, + "enumOptions": { + "type": "array", + "description": "Values for enum type", + "items": { + "type": "string" + } + }, + "defaultValue": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "string" + }, + { + "type": "boolean" + } + ], + "description": "Default value for property" + }, + "example": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "string" + }, + { + "type": "boolean" + } + ], + "description": "Example value for property, this value will be used in swagger documentation" + }, + "decimals": { + "type": "array", + "description": "Total digits of the number and length of the decimal places in the back of the number, example: [10, 2].", + "items": { + "type": "number" + } + }, + "autoIncrement": { + "type": "boolean", + "description": "Set number property as auto increment" + }, + "relationship": { + "$ref": "#/definitions/relationship" + }, + "webComponent": { + "$ref": "#/definitions/webComponent" + } + } + }, + "apiDefinition": { + "type": "object", + "required": [ + "path", + "resolverType", + "httpMethod" + ], + "properties": { + "path": { + "type": "string", + "description": "Path to access api" + }, + "resolverType": { + "type": "string", + "description": "Type of resolver, query or mutation", + "enum": [ + "query", + "mutation" + ] + }, + "httpMethod": { + "type": "string", + "description": "Verb of api rest", + "enum": [ + "get", + "post", + "put", + "delete", + "patch" + ] + } + } + }, + "relationship": { + "type": "object", + "additionalProperties": false, + "description": "Relationship definition for this property", + "properties": { + "type": { + "type": "string", + "description": "The type of web component", + "enum": [ + "many-to-many", + "many-to-one", + "none", + "one-to-many", + "one-to-one" + ] + }, + "singularName": { + "type": "string", + "description": "Singular name of the property referred to in the relationship, only for one-to-many and many-to-many relationship, example: book" + }, + "aggregate": { + "type": "string", + "description": "Aggregate referring to this relationship, example: LibraryAuthor" + }, + "modulePath": { + "type": "string", + "description": "Path to the module that refers to this relationship, example: library/author" + }, + "key": { + "type": "string", + "description": "Property key that refers to this relationship, only for many-to-one relationship, example: id" + }, + "field": { + "type": "string", + "description": "Field to obtain the relationship data, example: author" + }, + "avoidConstraint": { + "type": "boolean", + "description": "Avoid constraint rules for this relationship" + }, + "packageName": { + "type": "string", + "description": "Path to packageName where is the relationship, example: @aurora-ts/core" + }, + "isDenormalized": { + "type": "boolean", + "description": "Set many-to-many relationship as denormalized, creating a field to store the selected ids" + }, + "pivot": { + "$ref": "#/definitions/pivotTable" + } + } + }, + "webComponent": { + "type": "object", + "additionalProperties": false, + "description": "Web Component that wil be rendered for this property", + "properties": { + "type": { + "type": "string", + "description": "The type of web component", + "enum": [ + "grid-select-element", + "grid-elements-manager", + "select" + ] + } + } + }, + "pivotTable": { + "type": "object", + "additionalProperties": false, + "description": "Relationship pivot table definition for this relationship", + "properties": { + "aggregate": { + "type": "string", + "description": "AggregateName of Pivot table, example: IamRolesAccounts" + }, + "modulePath": { + "type": "string", + "description": "Module path where table model file will be saved, example: iam/role" + }, + "fileName": { + "type": "string", + "description": "Filename of pivot table model file, example: roles-accounts" + } + } + } + } + } \ No newline at end of file diff --git a/src/test/aurora-1.0/author.aurora.yaml b/src/test/aurora-1.0/author.aurora.yaml new file mode 100644 index 00000000000..accbad05212 --- /dev/null +++ b/src/test/aurora-1.0/author.aurora.yaml @@ -0,0 +1,38 @@ +version: 0.0.1 +boundedContextName: library +moduleName: author +moduleNames: authors +aggregateName: LibraryAuthor +hasOAuth: true +hasTenant: false +hasAuditing: false +aggregateProperties: + - name: id + type: id + primaryKey: true + length: 36 + nullable: false + - name: name + type: varchar + maxLength: 50 + nullable: false + - name: books + type: relationship + nullable: true + relationship: + type: one-to-many + singularName: book + aggregate: LibraryBook + modulePath: library/book + webComponent: + type: grid-elements-manager + - name: createdAt + type: timestamp + nullable: true + - name: updatedAt + type: timestamp + nullable: true + - name: deletedAt + type: timestamp + nullable: true +additionalApis: [] diff --git a/src/test/aurora-1.0/book.aurora.yaml b/src/test/aurora-1.0/book.aurora.yaml new file mode 100644 index 00000000000..3cf56ac5003 --- /dev/null +++ b/src/test/aurora-1.0/book.aurora.yaml @@ -0,0 +1,50 @@ +version: 0.0.1 +boundedContextName: library +moduleName: book +moduleNames: books +aggregateName: LibraryBook +hasOAuth: true +hasTenant: false +hasAuditing: false +aggregateProperties: + - name: id + type: id + primaryKey: true + length: 36 + nullable: false + - name: title + type: varchar + maxLength: 50 + nullable: false + - name: publishedAt + type: date + nullable: false + - name: price + type: int.unsigned + maxLength: 10 + nullable: false + - name: authorId + type: id + length: 36 + nullable: false + relationship: + type: many-to-one + aggregate: LibraryAuthor + modulePath: library/author + key: id + field: author + avoidConstraint: true + - name: authorName + type: varchar + maxLength: 50 + nullable: false + - name: createdAt + type: timestamp + nullable: true + - name: updatedAt + type: timestamp + nullable: true + - name: deletedAt + type: timestamp + nullable: true +additionalApis: [] diff --git a/src/test/aurora-1.0/country.aurora.yaml b/src/test/aurora-1.0/country.aurora.yaml new file mode 100644 index 00000000000..c7f5c491d52 --- /dev/null +++ b/src/test/aurora-1.0/country.aurora.yaml @@ -0,0 +1,146 @@ +version: 0.0.1 +boundedContextName: common +moduleName: country +moduleNames: countries +aggregateName: CommonCountry +hasOAuth: true +hasTenant: false +hasAuditing: true +aggregateProperties: + - name: id + type: id + primaryKey: true + length: 36 + nullable: false + - name: iso3166Alpha2 + type: char + length: 2 + nullable: false + index: index + - name: iso3166Alpha3 + type: char + length: 3 + nullable: false + index: index + - name: iso3166Numeric + type: char + length: 3 + nullable: false + index: index + - name: customCode + type: varchar + maxLength: 10 + nullable: true + index: index + - name: prefix + type: varchar + maxLength: 5 + nullable: true + - name: image + type: varchar + maxLength: 1024 + nullable: true + - name: sort + type: smallint.unsigned + maxLength: 6 + nullable: true + - name: administrativeAreas + type: json + nullable: true + - name: latitude + type: decimal + decimals: + - 16 + - 14 + nullable: true + - name: longitude + type: decimal + decimals: + - 17 + - 14 + nullable: true + - name: zoom + type: int.unsigned + maxLength: 2 + nullable: true + - name: mapType + type: enum + enumOptions: + - ROADMAP + - SATELLITE + - HYBRID + - TERRAIN + nullable: false + example: CommonCountryMapType.TERRAIN + - name: availableLangs + type: json + nullable: true + - name: createdAt + type: timestamp + nullable: true + - name: updatedAt + type: timestamp + nullable: true + - name: deletedAt + type: timestamp + nullable: true +aggregateI18nProperties: + - name: id + type: id + primaryKey: true + length: 36 + nullable: false + - name: countryId + type: id + length: 36 + nullable: false + relationship: + type: many-to-one + aggregate: CommonCountry + modulePath: common/country + key: id + field: country + index: unique + indexName: uniqueCountryIdLangId + - name: langId + type: id + length: 36 + nullable: false + relationship: + type: many-to-one + aggregate: CommonLang + modulePath: common/lang + key: id + field: lang + avoidConstraint: true + index: unique + indexName: uniqueCountryIdLangId + - name: name + type: varchar + nullable: false + - name: slug + type: varchar + maxLength: 1024 + nullable: false + - name: administrativeAreaLevel1 + type: varchar + maxLength: 50 + nullable: true + - name: administrativeAreaLevel2 + type: varchar + maxLength: 50 + nullable: true + - name: administrativeAreaLevel3 + type: varchar + maxLength: 50 + nullable: true + - name: createdAt + type: timestamp + nullable: true + - name: updatedAt + type: timestamp + nullable: true + - name: deletedAt + type: timestamp + nullable: true +additionalApis: [] diff --git a/src/test/aurora-1.0/lang.aurora.yaml b/src/test/aurora-1.0/lang.aurora.yaml new file mode 100644 index 00000000000..656ed25f4e6 --- /dev/null +++ b/src/test/aurora-1.0/lang.aurora.yaml @@ -0,0 +1,64 @@ +version: 0.0.1 +boundedContextName: common +moduleName: lang +moduleNames: langs +aggregateName: CommonLang +hasOAuth: true +hasTenant: false +hasAuditing: true +aggregateProperties: + - name: id + type: id + primaryKey: true + length: 36 + nullable: false + - name: name + type: varchar + nullable: false + - name: image + type: varchar + nullable: true + - name: iso6392 + type: char + length: 2 + nullable: false + index: index + - name: iso6393 + type: char + length: 3 + nullable: false + index: index + - name: ietf + type: char + length: 5 + nullable: false + index: index + - name: customCode + type: varchar + maxLength: 10 + nullable: true + index: index + - name: dir + type: enum + enumOptions: + - LTR + - RTL + nullable: false + - name: sort + type: smallint.unsigned + maxLength: 6 + nullable: true + - name: isActive + type: boolean + nullable: false + - name: createdAt + type: timestamp + nullable: true + - name: updatedAt + type: timestamp + nullable: true + - name: deletedAt + type: timestamp + nullable: true +aggregateI18nProperties: [] +additionalApis: []