@@ -173,10 +173,16 @@ public static function getRawKnownSchemas(): array
173173 'readOnly ' => true ,
174174 ],
175175 'name ' => ['type ' => Doc \Schema::TYPE_STRING ],
176- 'completename ' => ['type ' => Doc \Schema::TYPE_STRING ],
176+ 'completename ' => [
177+ 'type ' => Doc \Schema::TYPE_STRING ,
178+ 'readOnly ' => true ,
179+ ],
177180 'comment ' => ['type ' => Doc \Schema::TYPE_STRING ],
178181 'parent ' => self ::getDropdownTypeSchema (class: SoftwareCategory::class, full_schema: 'SoftwareCategory ' ),
179- 'level ' => ['type ' => Doc \Schema::TYPE_INTEGER ],
182+ 'level ' => [
183+ 'type ' => Doc \Schema::TYPE_INTEGER ,
184+ 'readOnly ' => true ,
185+ ],
180186 ],
181187 ];
182188
@@ -296,7 +302,6 @@ public static function getRawKnownSchemas(): array
296302 'depth ' => ['type ' => Doc \Schema::TYPE_NUMBER , 'format ' => Doc \Schema::FORMAT_NUMBER_FLOAT ],
297303 'power_connections ' => ['type ' => Doc \Schema::TYPE_INTEGER ],
298304 'power_consumption ' => ['type ' => Doc \Schema::TYPE_INTEGER ],
299- 'max_power ' => ['type ' => Doc \Schema::TYPE_INTEGER ],
300305 'is_half_rack ' => ['type ' => Doc \Schema::TYPE_BOOLEAN ],
301306 'date_creation ' => ['type ' => Doc \Schema::TYPE_STRING , 'format ' => Doc \Schema::FORMAT_STRING_DATE_TIME ],
302307 'date_mod ' => ['type ' => Doc \Schema::TYPE_STRING , 'format ' => Doc \Schema::FORMAT_STRING_DATE_TIME ],
@@ -530,7 +535,11 @@ class: User::class,
530535 }
531536
532537 if ($ asset ->isField ('uuid ' )) {
533- $ schemas [$ schema_name ]['properties ' ]['uuid ' ] = ['type ' => Doc \Schema::TYPE_STRING ];
538+ $ schemas [$ schema_name ]['properties ' ]['uuid ' ] = [
539+ 'type ' => Doc \Schema::TYPE_STRING ,
540+ 'pattern ' => Doc \Schema::PATTERN_UUIDV4 ,
541+ 'readOnly ' => true ,
542+ ];
534543 }
535544 if ($ asset ->isField ('autoupdatesystems_id ' )) {
536545 $ schemas [$ schema_name ]['properties ' ]['autoupdatesystem ' ] = self ::getDropdownTypeSchema (AutoUpdateSystem::class);
@@ -541,6 +550,19 @@ class: User::class,
541550 }
542551 }
543552
553+ // Post v2 additions to general assets
554+ $ schemas ['SoftwareLicense ' ]['properties ' ]['completename ' ] = [
555+ 'x-version-introduced ' => '2.1.0 ' ,
556+ 'type ' => Doc \Schema::TYPE_STRING ,
557+ 'readOnly ' => true ,
558+ ];
559+ $ schemas ['SoftwareLicense ' ]['properties ' ]['level ' ] = [
560+ 'x-version-introduced ' => '2.1.0 ' ,
561+ 'type ' => Doc \Schema::TYPE_INTEGER ,
562+ 'readOnly ' => true ,
563+ ];
564+
565+ // Additional asset schemas
544566 $ schemas ['Cartridge ' ] = [
545567 'x-version-introduced ' => '2.0 ' ,
546568 'x-itemtype ' => Cartridge::class,
@@ -820,7 +842,10 @@ class: User::class,
820842 ],
821843 'is_deleted ' => ['type ' => Doc \Schema::TYPE_BOOLEAN ],
822844 'is_update ' => ['type ' => Doc \Schema::TYPE_BOOLEAN ],
823- 'is_valid ' => ['type ' => Doc \Schema::TYPE_BOOLEAN ],
845+ 'is_valid ' => [
846+ 'type ' => Doc \Schema::TYPE_BOOLEAN ,
847+ 'readOnly ' => true ,
848+ ],
824849 'date_creation ' => ['type ' => Doc \Schema::TYPE_STRING , 'format ' => Doc \Schema::FORMAT_STRING_DATE_TIME ],
825850 'date_mod ' => ['type ' => Doc \Schema::TYPE_STRING , 'format ' => Doc \Schema::FORMAT_STRING_DATE_TIME ],
826851 ],
@@ -939,7 +964,10 @@ class: User::class,
939964 'room ' => self ::getDropdownTypeSchema (class: DCRoom::class, full_schema: 'DCRoom ' ),
940965 'room_orientation ' => ['type ' => Doc \Schema::TYPE_INTEGER , 'format ' => Doc \Schema::FORMAT_INTEGER_INT32 ],
941966 'position ' => ['type ' => Doc \Schema::TYPE_STRING ],
942- 'bgcolor ' => ['type ' => Doc \Schema::TYPE_STRING ],
967+ 'bgcolor ' => [
968+ 'type ' => Doc \Schema::TYPE_STRING ,
969+ 'pattern ' => Doc \Schema::PATTERN_COLOR_HEX ,
970+ ],
943971 'max_power ' => ['type ' => Doc \Schema::TYPE_INTEGER , 'format ' => Doc \Schema::FORMAT_INTEGER_INT32 ],
944972 'measured_power ' => [
945973 'type ' => Doc \Schema::TYPE_INTEGER ,
@@ -999,7 +1027,10 @@ class: User::class,
9991027 - 1: Rear
10001028 EOT ,
10011029 ],
1002- 'bgcolor ' => ['type ' => Doc \Schema::TYPE_STRING ],
1030+ 'bgcolor ' => [
1031+ 'type ' => Doc \Schema::TYPE_STRING ,
1032+ 'pattern ' => Doc \Schema::PATTERN_COLOR_HEX ,
1033+ ],
10031034 'position_horizontal ' => [
10041035 'type ' => Doc \Schema::TYPE_INTEGER ,
10051036 'format ' => Doc \Schema::FORMAT_INTEGER_INT32 ,
@@ -1411,6 +1442,7 @@ public static function getAssetTypes(bool $types_only = true): array
14111442
14121443 if ($ assets === null ) {
14131444 $ assets = [];
1445+ //TODO remove SoftwareLicense in v3 as it is a duplicate of License in the Management Controller
14141446 $ types = ['Computer ' , 'Monitor ' , 'NetworkEquipment ' ,
14151447 'Peripheral ' , 'Phone ' , 'Printer ' , 'SoftwareLicense ' ,
14161448 'Certificate ' , 'Unmanaged ' , 'Appliance ' ,
0 commit comments