@@ -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,16 +728,21 @@ _M.consumer = {
718
728
_M .credential = {
719
729
type = " object" ,
720
730
properties = {
731
+ -- metadata
721
732
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
722
740
plugins = {
723
741
type = " object" ,
724
742
maxProperties = 1 ,
725
743
},
726
- labels = labels_def ,
727
- create_time = timestamp_def ,
728
- update_time = timestamp_def ,
729
- desc = desc_def ,
730
744
},
745
+ additionalProperties = false ,
731
746
}
732
747
733
748
_M .upstream = upstream_schema
@@ -742,7 +757,14 @@ local secret_uri_schema = {
742
757
_M .ssl = {
743
758
type = " object" ,
744
759
properties = {
760
+ -- metadata
745
761
id = id_schema ,
762
+ desc = desc_def ,
763
+ labels = labels_def ,
764
+ create_time = timestamp_def ,
765
+ update_time = timestamp_def ,
766
+
767
+ -- properties
746
768
type = {
747
769
description = " ssl certificate type, " ..
748
770
" server to server certificate, " ..
@@ -814,7 +836,6 @@ _M.ssl = {
814
836
},
815
837
required = {" ca" },
816
838
},
817
- labels = labels_def ,
818
839
status = {
819
840
description = " ssl status, 1 to enable, 0 to disable" ,
820
841
type = " integer" ,
@@ -830,8 +851,6 @@ _M.ssl = {
830
851
enum = {" TLSv1.1" , " TLSv1.2" , " TLSv1.3" }
831
852
},
832
853
},
833
- create_time = timestamp_def ,
834
- update_time = timestamp_def
835
854
},
836
855
[" if" ] = {
837
856
properties = {
@@ -852,13 +871,20 @@ _M.ssl = {
852
871
853
872
854
873
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
855
876
_M .proto = {
856
877
type = " object" ,
857
878
properties = {
879
+ -- metadata
858
880
id = id_schema ,
881
+ name = rule_name_def ,
859
882
desc = desc_def ,
883
+ labels = labels_def ,
860
884
create_time = timestamp_def ,
861
885
update_time = timestamp_def ,
886
+
887
+ -- properties
862
888
content = {
863
889
type = " string" , minLength = 1 , maxLength = 1024 * 1024
864
890
}
@@ -871,10 +897,13 @@ _M.proto = {
871
897
_M .global_rule = {
872
898
type = " object" ,
873
899
properties = {
900
+ -- metadata
874
901
id = id_schema ,
875
- plugins = plugins_schema ,
876
902
create_time = timestamp_def ,
877
- update_time = timestamp_def
903
+ update_time = timestamp_def ,
904
+
905
+ -- properties
906
+ plugins = plugins_schema ,
878
907
},
879
908
required = {" id" , " plugins" },
880
909
additionalProperties = false ,
@@ -923,12 +952,16 @@ local xrpc_protocol_schema = {
923
952
_M .stream_route = {
924
953
type = " object" ,
925
954
properties = {
955
+ -- metadata
926
956
id = id_schema ,
957
+ name = rule_name_def ,
927
958
desc = desc_def ,
959
+ labels = labels_def ,
928
960
create_time = timestamp_def ,
929
961
update_time = timestamp_def ,
962
+
963
+ -- properties
930
964
remote_addr = remote_addr_def ,
931
- labels = labels_def , -- The ingress project need this field
932
965
server_addr = {
933
966
description = " server IP" ,
934
967
type = " string" ,
@@ -977,15 +1010,18 @@ _M.plugins = {
977
1010
_M .plugin_config = {
978
1011
type = " object" ,
979
1012
properties = {
1013
+ -- metadata
1014
+ id = id_schema ,
980
1015
name = {
981
1016
type = " string" ,
982
1017
},
983
- id = id_schema ,
984
1018
desc = desc_def ,
985
- plugins = plugins_schema ,
986
1019
labels = labels_def ,
987
1020
create_time = timestamp_def ,
988
- update_time = timestamp_def
1021
+ update_time = timestamp_def ,
1022
+
1023
+ -- properties
1024
+ plugins = plugins_schema ,
989
1025
},
990
1026
required = {" id" , " plugins" },
991
1027
additionalProperties = false ,
@@ -995,12 +1031,16 @@ _M.plugin_config = {
995
1031
_M .consumer_group = {
996
1032
type = " object" ,
997
1033
properties = {
1034
+ -- metadata
998
1035
id = id_schema ,
1036
+ name = rule_name_def ,
999
1037
desc = desc_def ,
1000
- plugins = plugins_schema ,
1001
1038
labels = labels_def ,
1002
1039
create_time = timestamp_def ,
1003
- update_time = timestamp_def
1040
+ update_time = timestamp_def ,
1041
+
1042
+ -- properties
1043
+ plugins = plugins_schema ,
1004
1044
},
1005
1045
required = {" id" , " plugins" },
1006
1046
additionalProperties = false ,
0 commit comments