@@ -383,8 +383,15 @@ local private_key_schema = {
383
383
local upstream_schema = {
384
384
type = " object" ,
385
385
properties = {
386
+ -- metadata
387
+ id = id_schema ,
388
+ name = rule_name_def ,
389
+ desc = desc_def ,
390
+ labels = labels_def ,
386
391
create_time = timestamp_def ,
387
392
update_time = timestamp_def ,
393
+
394
+ -- properties
388
395
nodes = nodes_schema ,
389
396
retries = {
390
397
type = " integer" ,
@@ -466,7 +473,6 @@ local upstream_schema = {
466
473
" For L4 proxy, it can be one of tcp/tls/udp." ..
467
474
" For specific protocols, it can be kafka."
468
475
},
469
- labels = labels_def ,
470
476
discovery_type = {
471
477
description = " discovery type" ,
472
478
type = " string" ,
@@ -491,14 +497,11 @@ local upstream_schema = {
491
497
default = " pass"
492
498
},
493
499
upstream_host = host_def ,
494
- name = rule_name_def ,
495
- desc = desc_def ,
496
500
service_name = {
497
501
type = " string" ,
498
502
maxLength = 256 ,
499
503
minLength = 1
500
504
},
501
- id = id_schema ,
502
505
},
503
506
oneOf = {
504
507
{required = {" nodes" }},
@@ -542,8 +545,15 @@ _M.method_schema = method_schema
542
545
_M .route = {
543
546
type = " object" ,
544
547
properties = {
548
+ -- metadata
549
+ id = id_schema ,
550
+ name = rule_name_def ,
551
+ desc = desc_def ,
552
+ labels = labels_def ,
545
553
create_time = timestamp_def ,
546
554
update_time = timestamp_def ,
555
+
556
+ -- properties
547
557
uri = {type = " string" , minLength = 1 , maxLength = 4096 },
548
558
uris = {
549
559
type = " array" ,
@@ -554,8 +564,6 @@ _M.route = {
554
564
minItems = 1 ,
555
565
uniqueItems = true ,
556
566
},
557
- name = rule_name_def ,
558
- desc = desc_def ,
559
567
priority = {type = " integer" , default = 0 },
560
568
561
569
methods = {
@@ -596,8 +604,6 @@ _M.route = {
596
604
597
605
upstream = upstream_schema ,
598
606
599
- labels = labels_def ,
600
-
601
607
service_id = id_schema ,
602
608
upstream_id = id_schema ,
603
609
@@ -606,8 +612,6 @@ _M.route = {
606
612
type = " boolean" ,
607
613
},
608
614
609
- id = id_schema ,
610
-
611
615
status = {
612
616
description = " route status, 1 to enable, 0 to disable" ,
613
617
type = " integer" ,
@@ -672,16 +676,19 @@ _M.route = {
672
676
_M .service = {
673
677
type = " object" ,
674
678
properties = {
679
+ -- metadata
675
680
id = id_schema ,
676
- plugins = plugins_schema ,
677
- upstream = upstream_schema ,
678
- upstream_id = id_schema ,
679
681
name = rule_name_def ,
680
682
desc = desc_def ,
681
683
labels = labels_def ,
682
- script = {type = " string" , minLength = 10 , maxLength = 102400 },
683
684
create_time = timestamp_def ,
684
685
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 },
685
692
enable_websocket = {
686
693
description = " enable websocket for request" ,
687
694
type = " boolean" ,
@@ -700,16 +707,19 @@ _M.service = {
700
707
_M .consumer = {
701
708
type = " object" ,
702
709
properties = {
710
+ -- metadata
703
711
username = {
704
712
type = " string" , minLength = 1 , maxLength = rule_name_def .maxLength ,
705
713
pattern = [[ ^[a-zA-Z0-9_]+$]]
706
714
},
707
- group_id = id_schema ,
708
- plugins = plugins_schema ,
715
+ desc = desc_def ,
709
716
labels = labels_def ,
710
717
create_time = timestamp_def ,
711
718
update_time = timestamp_def ,
712
- desc = desc_def ,
719
+
720
+ -- properties
721
+ group_id = id_schema ,
722
+ plugins = plugins_schema ,
713
723
},
714
724
required = {" username" },
715
725
additionalProperties = false ,
@@ -718,6 +728,7 @@ _M.consumer = {
718
728
_M .credential = {
719
729
type = " object" ,
720
730
properties = {
731
+ -- metadata
721
732
id = {
722
733
oneOf = {
723
734
id_schema ,
@@ -730,15 +741,19 @@ _M.credential = {
730
741
}
731
742
}
732
743
},
744
+ name = rule_name_def ,
745
+ desc = desc_def ,
746
+ labels = labels_def ,
747
+ create_time = timestamp_def ,
748
+ update_time = timestamp_def ,
749
+
750
+ -- properties
733
751
plugins = {
734
752
type = " object" ,
735
753
maxProperties = 1 ,
736
754
},
737
- labels = labels_def ,
738
- create_time = timestamp_def ,
739
- update_time = timestamp_def ,
740
- desc = desc_def ,
741
755
},
756
+ additionalProperties = false ,
742
757
}
743
758
744
759
_M .upstream = upstream_schema
@@ -753,7 +768,14 @@ local secret_uri_schema = {
753
768
_M .ssl = {
754
769
type = " object" ,
755
770
properties = {
771
+ -- metadata
756
772
id = id_schema ,
773
+ desc = desc_def ,
774
+ labels = labels_def ,
775
+ create_time = timestamp_def ,
776
+ update_time = timestamp_def ,
777
+
778
+ -- properties
757
779
type = {
758
780
description = " ssl certificate type, " ..
759
781
" server to server certificate, " ..
@@ -825,7 +847,6 @@ _M.ssl = {
825
847
},
826
848
required = {" ca" },
827
849
},
828
- labels = labels_def ,
829
850
status = {
830
851
description = " ssl status, 1 to enable, 0 to disable" ,
831
852
type = " integer" ,
@@ -841,8 +862,6 @@ _M.ssl = {
841
862
enum = {" TLSv1.1" , " TLSv1.2" , " TLSv1.3" }
842
863
},
843
864
},
844
- create_time = timestamp_def ,
845
- update_time = timestamp_def
846
865
},
847
866
[" if" ] = {
848
867
properties = {
@@ -863,13 +882,20 @@ _M.ssl = {
863
882
864
883
865
884
885
+ -- TODO: Design a plugin resource registration framework used by plugins and move the proto
886
+ -- resource to grpc-transcode plugin, which should not be an APISIX core resource
866
887
_M .proto = {
867
888
type = " object" ,
868
889
properties = {
890
+ -- metadata
869
891
id = id_schema ,
892
+ name = rule_name_def ,
870
893
desc = desc_def ,
894
+ labels = labels_def ,
871
895
create_time = timestamp_def ,
872
896
update_time = timestamp_def ,
897
+
898
+ -- properties
873
899
content = {
874
900
type = " string" , minLength = 1 , maxLength = 1024 * 1024
875
901
}
@@ -882,10 +908,13 @@ _M.proto = {
882
908
_M .global_rule = {
883
909
type = " object" ,
884
910
properties = {
911
+ -- metadata
885
912
id = id_schema ,
886
- plugins = plugins_schema ,
887
913
create_time = timestamp_def ,
888
- update_time = timestamp_def
914
+ update_time = timestamp_def ,
915
+
916
+ -- properties
917
+ plugins = plugins_schema ,
889
918
},
890
919
required = {" id" , " plugins" },
891
920
additionalProperties = false ,
@@ -934,12 +963,16 @@ local xrpc_protocol_schema = {
934
963
_M .stream_route = {
935
964
type = " object" ,
936
965
properties = {
966
+ -- metadata
937
967
id = id_schema ,
968
+ name = rule_name_def ,
938
969
desc = desc_def ,
970
+ labels = labels_def ,
939
971
create_time = timestamp_def ,
940
972
update_time = timestamp_def ,
973
+
974
+ -- properties
941
975
remote_addr = remote_addr_def ,
942
- labels = labels_def , -- The ingress project need this field
943
976
server_addr = {
944
977
description = " server IP" ,
945
978
type = " string" ,
@@ -988,15 +1021,18 @@ _M.plugins = {
988
1021
_M .plugin_config = {
989
1022
type = " object" ,
990
1023
properties = {
1024
+ -- metadata
1025
+ id = id_schema ,
991
1026
name = {
992
1027
type = " string" ,
993
1028
},
994
- id = id_schema ,
995
1029
desc = desc_def ,
996
- plugins = plugins_schema ,
997
1030
labels = labels_def ,
998
1031
create_time = timestamp_def ,
999
- update_time = timestamp_def
1032
+ update_time = timestamp_def ,
1033
+
1034
+ -- properties
1035
+ plugins = plugins_schema ,
1000
1036
},
1001
1037
required = {" id" , " plugins" },
1002
1038
additionalProperties = false ,
@@ -1006,12 +1042,16 @@ _M.plugin_config = {
1006
1042
_M .consumer_group = {
1007
1043
type = " object" ,
1008
1044
properties = {
1045
+ -- metadata
1009
1046
id = id_schema ,
1047
+ name = rule_name_def ,
1010
1048
desc = desc_def ,
1011
- plugins = plugins_schema ,
1012
1049
labels = labels_def ,
1013
1050
create_time = timestamp_def ,
1014
- update_time = timestamp_def
1051
+ update_time = timestamp_def ,
1052
+
1053
+ -- properties
1054
+ plugins = plugins_schema ,
1015
1055
},
1016
1056
required = {" id" , " plugins" },
1017
1057
additionalProperties = false ,
0 commit comments