@@ -28,15 +28,17 @@ def add_resource(
2828 self ,
2929 path : str ,
3030 resource : t .Union [Resource , type [Resource ]],
31- tags : t .Optional [dict [str , dict [str , t .Any ]]] = None ,
3231 * args ,
32+ include_in_schema : bool = True ,
33+ tags : t .Optional [dict [str , dict [str , t .Any ]]] = None ,
3334 ** kwargs ,
3435 ) -> "Resource" :
3536 """Adds a resource to this application, setting its endpoints.
3637
3738 :param path: Resource base path.
38- :param tags: Tags to add to the resource.
3939 :param resource: Resource class.
40+ :param include_in_schema: True if this route or endpoint should be declared as part of the API schema.
41+ :param tags: Tags to add to the resource.
4042 """
4143 if inspect .isclass (resource ) and issubclass (resource , Resource ):
4244 resource_instance = resource (* args , ** kwargs )
@@ -45,20 +47,28 @@ def add_resource(
4547 else :
4648 raise ValueError ("Wrong resource" )
4749
48- self .app .mount (mount = ResourceRoute (path , resource_instance , tags ))
50+ self .app .mount (mount = ResourceRoute (path , resource_instance , include_in_schema = include_in_schema , tags = tags ))
4951
5052 return resource_instance
5153
52- def resource (self , path : str , tags : t .Optional [dict [str , dict [str , t .Any ]]] = None , * args , ** kwargs ) -> t .Callable :
54+ def resource (
55+ self ,
56+ path : str ,
57+ * args ,
58+ include_in_schema : bool = True ,
59+ tags : t .Optional [dict [str , dict [str , t .Any ]]] = None ,
60+ ** kwargs ,
61+ ) -> t .Callable :
5362 """Decorator for Resources classes for adding them to the application.
5463
5564 :param path: Resource base path.
65+ :param include_in_schema: True if this route or endpoint should be declared as part of the API schema.
5666 :param tags: Tags to add to the resource.
5767 :return: Decorated resource class.
5868 """
5969
6070 def decorator (resource : type [Resource ]) -> type [Resource ]:
61- self .add_resource (path , resource , tags , * args , ** kwargs )
71+ self .add_resource (path , resource , * args , include_in_schema = include_in_schema , tags = tags , ** kwargs )
6272 return resource
6373
6474 return decorator
0 commit comments