@@ -383,8 +383,15 @@ local private_key_schema = {
383383local upstream_schema = {
384384 type = " object" ,
385385 properties = {
386+ -- metadata
387+ id = id_schema ,
388+ name = rule_name_def ,
389+ desc = desc_def ,
390+ labels = labels_def ,
386391 create_time = timestamp_def ,
387392 update_time = timestamp_def ,
393+
394+ -- properties
388395 nodes = nodes_schema ,
389396 retries = {
390397 type = " integer" ,
@@ -466,7 +473,6 @@ local upstream_schema = {
466473 " For L4 proxy, it can be one of tcp/tls/udp." ..
467474 " For specific protocols, it can be kafka."
468475 },
469- labels = labels_def ,
470476 discovery_type = {
471477 description = " discovery type" ,
472478 type = " string" ,
@@ -491,14 +497,11 @@ local upstream_schema = {
491497 default = " pass"
492498 },
493499 upstream_host = host_def ,
494- name = rule_name_def ,
495- desc = desc_def ,
496500 service_name = {
497501 type = " string" ,
498502 maxLength = 256 ,
499503 minLength = 1
500504 },
501- id = id_schema ,
502505 },
503506 oneOf = {
504507 {required = {" nodes" }},
@@ -542,8 +545,15 @@ _M.method_schema = method_schema
542545_M .route = {
543546 type = " object" ,
544547 properties = {
548+ -- metadata
549+ id = id_schema ,
550+ name = rule_name_def ,
551+ desc = desc_def ,
552+ labels = labels_def ,
545553 create_time = timestamp_def ,
546554 update_time = timestamp_def ,
555+
556+ -- properties
547557 uri = {type = " string" , minLength = 1 , maxLength = 4096 },
548558 uris = {
549559 type = " array" ,
@@ -554,8 +564,6 @@ _M.route = {
554564 minItems = 1 ,
555565 uniqueItems = true ,
556566 },
557- name = rule_name_def ,
558- desc = desc_def ,
559567 priority = {type = " integer" , default = 0 },
560568
561569 methods = {
@@ -596,8 +604,6 @@ _M.route = {
596604
597605 upstream = upstream_schema ,
598606
599- labels = labels_def ,
600-
601607 service_id = id_schema ,
602608 upstream_id = id_schema ,
603609
@@ -606,8 +612,6 @@ _M.route = {
606612 type = " boolean" ,
607613 },
608614
609- id = id_schema ,
610-
611615 status = {
612616 description = " route status, 1 to enable, 0 to disable" ,
613617 type = " integer" ,
@@ -672,16 +676,19 @@ _M.route = {
672676_M .service = {
673677 type = " object" ,
674678 properties = {
679+ -- metadata
675680 id = id_schema ,
676- plugins = plugins_schema ,
677- upstream = upstream_schema ,
678- upstream_id = id_schema ,
679681 name = rule_name_def ,
680682 desc = desc_def ,
681683 labels = labels_def ,
682- script = {type = " string" , minLength = 10 , maxLength = 102400 },
683684 create_time = timestamp_def ,
684685 update_time = timestamp_def ,
686+
687+ -- properties
688+ plugins = plugins_schema ,
689+ upstream = upstream_schema ,
690+ upstream_id = id_schema ,
691+ script = {type = " string" , minLength = 10 , maxLength = 102400 },
685692 enable_websocket = {
686693 description = " enable websocket for request" ,
687694 type = " boolean" ,
@@ -700,16 +707,19 @@ _M.service = {
700707_M .consumer = {
701708 type = " object" ,
702709 properties = {
710+ -- metadata
703711 username = {
704712 type = " string" , minLength = 1 , maxLength = rule_name_def .maxLength ,
705713 pattern = [[ ^[a-zA-Z0-9_]+$]]
706714 },
707- group_id = id_schema ,
708- plugins = plugins_schema ,
715+ desc = desc_def ,
709716 labels = labels_def ,
710717 create_time = timestamp_def ,
711718 update_time = timestamp_def ,
712- desc = desc_def ,
719+
720+ -- properties
721+ group_id = id_schema ,
722+ plugins = plugins_schema ,
713723 },
714724 required = {" username" },
715725 additionalProperties = false ,
@@ -718,16 +728,21 @@ _M.consumer = {
718728_M .credential = {
719729 type = " object" ,
720730 properties = {
731+ -- metadata
721732 id = id_schema ,
733+ name = rule_name_def ,
734+ desc = desc_def ,
735+ labels = labels_def ,
736+ create_time = timestamp_def ,
737+ update_time = timestamp_def ,
738+
739+ -- properties
722740 plugins = {
723741 type = " object" ,
724742 maxProperties = 1 ,
725743 },
726- labels = labels_def ,
727- create_time = timestamp_def ,
728- update_time = timestamp_def ,
729- desc = desc_def ,
730744 },
745+ additionalProperties = false ,
731746}
732747
733748_M .upstream = upstream_schema
@@ -742,7 +757,14 @@ local secret_uri_schema = {
742757_M .ssl = {
743758 type = " object" ,
744759 properties = {
760+ -- metadata
745761 id = id_schema ,
762+ desc = desc_def ,
763+ labels = labels_def ,
764+ create_time = timestamp_def ,
765+ update_time = timestamp_def ,
766+
767+ -- properties
746768 type = {
747769 description = " ssl certificate type, " ..
748770 " server to server certificate, " ..
@@ -814,7 +836,6 @@ _M.ssl = {
814836 },
815837 required = {" ca" },
816838 },
817- labels = labels_def ,
818839 status = {
819840 description = " ssl status, 1 to enable, 0 to disable" ,
820841 type = " integer" ,
@@ -830,8 +851,6 @@ _M.ssl = {
830851 enum = {" TLSv1.1" , " TLSv1.2" , " TLSv1.3" }
831852 },
832853 },
833- create_time = timestamp_def ,
834- update_time = timestamp_def
835854 },
836855 [" if" ] = {
837856 properties = {
@@ -852,13 +871,20 @@ _M.ssl = {
852871
853872
854873
874+ -- TODO: Design a plugin resource registration framework used by plugins and move the proto
875+ -- resource to grpc-transcode plugin, which should not be an APISIX core resource
855876_M .proto = {
856877 type = " object" ,
857878 properties = {
879+ -- metadata
858880 id = id_schema ,
881+ name = rule_name_def ,
859882 desc = desc_def ,
883+ labels = labels_def ,
860884 create_time = timestamp_def ,
861885 update_time = timestamp_def ,
886+
887+ -- properties
862888 content = {
863889 type = " string" , minLength = 1 , maxLength = 1024 * 1024
864890 }
@@ -871,10 +897,13 @@ _M.proto = {
871897_M .global_rule = {
872898 type = " object" ,
873899 properties = {
900+ -- metadata
874901 id = id_schema ,
875- plugins = plugins_schema ,
876902 create_time = timestamp_def ,
877- update_time = timestamp_def
903+ update_time = timestamp_def ,
904+
905+ -- properties
906+ plugins = plugins_schema ,
878907 },
879908 required = {" id" , " plugins" },
880909 additionalProperties = false ,
@@ -923,12 +952,16 @@ local xrpc_protocol_schema = {
923952_M .stream_route = {
924953 type = " object" ,
925954 properties = {
955+ -- metadata
926956 id = id_schema ,
957+ name = rule_name_def ,
927958 desc = desc_def ,
959+ labels = labels_def ,
928960 create_time = timestamp_def ,
929961 update_time = timestamp_def ,
962+
963+ -- properties
930964 remote_addr = remote_addr_def ,
931- labels = labels_def , -- The ingress project need this field
932965 server_addr = {
933966 description = " server IP" ,
934967 type = " string" ,
@@ -977,15 +1010,18 @@ _M.plugins = {
9771010_M .plugin_config = {
9781011 type = " object" ,
9791012 properties = {
1013+ -- metadata
1014+ id = id_schema ,
9801015 name = {
9811016 type = " string" ,
9821017 },
983- id = id_schema ,
9841018 desc = desc_def ,
985- plugins = plugins_schema ,
9861019 labels = labels_def ,
9871020 create_time = timestamp_def ,
988- update_time = timestamp_def
1021+ update_time = timestamp_def ,
1022+
1023+ -- properties
1024+ plugins = plugins_schema ,
9891025 },
9901026 required = {" id" , " plugins" },
9911027 additionalProperties = false ,
@@ -995,12 +1031,16 @@ _M.plugin_config = {
9951031_M .consumer_group = {
9961032 type = " object" ,
9971033 properties = {
1034+ -- metadata
9981035 id = id_schema ,
1036+ name = rule_name_def ,
9991037 desc = desc_def ,
1000- plugins = plugins_schema ,
10011038 labels = labels_def ,
10021039 create_time = timestamp_def ,
1003- update_time = timestamp_def
1040+ update_time = timestamp_def ,
1041+
1042+ -- properties
1043+ plugins = plugins_schema ,
10041044 },
10051045 required = {" id" , " plugins" },
10061046 additionalProperties = false ,
0 commit comments