api_platform.yaml 9.62 KB
Newer Older
Julien Jorry committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268
api_platform:
    title: 'API Kohinos'
    version: '2.1.3'
    enable_fos_user: true
    eager_loading:
        max_joins: 20
    # enable_entrypoint: false
    mapping:
        paths: ['%kernel.project_dir%/src/Entity']
    swagger:
         api_keys:
             apiKey:
                name: API-AUTH-TOKEN
                type: header

############################## 
###  DEFAULT CONFIGURATION ###
##############################
#
# api_platform:

#     # The title of the API.
#     title: 'API title'

#     # The description of the API.
#     description: 'API description'

#     # The version of the API.
#     version: '0.0.0'

#     # Set this to false if you want Webby to disappear.
#     show_webby: true

#     # Specify a name converter to use.
#     name_converter: ~

#     # Specify a path name generator to use.
#     path_segment_name_generator: 'api_platform.path_segment_name_generator.underscore'

#     # Allow using plain IDs for JSON format
#     allow_plain_identifiers: false

#     validator:
#         # Enable the serialization of payload fields when a validation error is thrown
#         # If you want to serialize only some payload fields, define them like this [ severity, anotherPayloadField ]
#         serialize_payload_fields: []

#     eager_loading:
#         # To enable or disable eager loading.
#         enabled: true

#         # Fetch only partial data according to serialization groups.
#         # If enabled, Doctrine ORM entities will not work as expected if any of the other fields are used.
#         fetch_partial: false

#         # Max number of joined relations before EagerLoading throws a RuntimeException.
#         max_joins: 30

#         # Force join on every relation.
#         # If disabled, it will only join relations having the EAGER fetch mode.
#         force_eager: true

#     # Enable the FOSUserBundle integration.
#     enable_fos_user: false

#     # Enabling the NelmioApiDocBundle integration has been deprecated in 2.2 and will be removed in 3.0.
#     # NelmioApiDocBundle 3 has native support for API Platform
#     enable_nelmio_api_doc: false

#     # Enable the Swagger documentation and export.
#     enable_swagger: true

#     # Enable Swagger ui.
#     enable_swagger_ui: true

#     # Enable ReDoc.
#     enable_re_doc: true

#     # Enable the entrypoint.
#     enable_entrypoint: true

#     # Enable the docs.
#     enable_docs: true
    
#     # Enable the data collector and the WebProfilerBundle integration.
#     enable_profiler: true

#     collection:
#         # The name of the query parameter to filter nullable results (with the ExistsFilter).
#         exists_parameter_name: 'exists'

#         # The default order of results.
#         order: 'ASC'

#         # The name of the query parameter to order results (with the OrderFilter).
#         order_parameter_name: 'order'

#         pagination:
#             # To enable or disable pagination for all resource collections by default.
#             enabled: true

#             # To allow partial pagination for all resource collections.
#             # This improves performances by skipping the `COUNT` query.
#             partial: false

#             # To allow the client to enable or disable the pagination.
#             client_enabled: false

#             # To allow the client to set the number of items per page.
#             client_items_per_page: false

#             # To allow the client to enable or disable the partial pagination.
#             client_partial: false

#             # The default number of items per page.
#             items_per_page: 30

#             # The maximum number of items per page.
#             maximum_items_per_page: ~

#             # The default name of the parameter handling the page number.
#             page_parameter_name: 'page'

#             # The name of the query parameter to enable or disable pagination.
#             enabled_parameter_name: 'pagination'

#             # The name of the query parameter to set the number of items per page.
#             items_per_page_parameter_name: 'itemsPerPage'

#             # The name of the query parameter to enable or disable the partial pagination.
#             partial_parameter_name: 'partial'

#     mapping:
#         # The list of paths with files or directories where the bundle will look for additional resource files.
#         paths: []

#     # The list of your resources class directories. Defaults to the directories of the mapping paths but might differ.
#     resource_class_directories:
#         - '%kernel.project_dir%/src/Entity'

#     doctrine:
#         # To enable or disable Doctrine ORM support.
#         enabled: true

#     doctrine_mongodb_odm:
#         # To enable or disable Doctrine MongoDB ODM support.
#         enabled: false

#     oauth:
#         # To enable or disable oauth.
#         enabled: false

#         # The oauth client id.
#         clientId: ''

#         # The oauth client secret.
#         clientSecret: ''

#         # The oauth type.
#         type: 'oauth2'

#         # The oauth flow grant type.
#         flow: 'application'

#         # The oauth token url.
#         tokenUrl: '/oauth/v2/token'

#         # The oauth authentication url.
#         authorizationUrl: '/oauth/v2/auth'

#         # The oauth scopes.
#         scopes: []

#     graphql:
#         # Enabled by default with installed GraphQL
#         enabled: false

#         # The default IDE (graphiql or graphql-playground) used when going to the GraphQL endpoint. False to disable.
#         default_ide: 'graphiql'

#         graphiql:
#             # Enabled by default with installed GraphQL and Twig
#             enabled: false

#         graphql_playground:
#             # Enabled by default with installed GraphQL and Twig
#             enabled: false

#         # The nesting separator used in the filter names.
#         nesting_separator: _

#         collection:
#             pagination:
#                 enabled: true

#     swagger:
#         # The active versions of OpenAPI to be exported or used in the swagger_ui. The first value is the default.
#         versions: [2, 3]
                
#         # The swagger api keys.
#         api_keys: []
#             # The name of the header or query parameter containing the api key.
#             # name: ''

#             # Whether the api key should be a query parameter or a header.
#             # type: 'query' or 'header'

#     http_cache:
#         # Automatically generate etags for API responses.
#         etag: true

#         # Default value for the response max age.
#         max_age: 3600

#         # Default value for the response shared (proxy) max age.
#         shared_max_age: 3600

#         # Default values of the "Vary" HTTP header.
#         vary: ['Accept']

#         # To make all responses public by default.
#         public: ~

#         invalidation:
#           # To enable the tags-based cache invalidation system.
#           enabled: false

#           # URLs of the Varnish servers to purge using cache tags when a resource is updated.
#           varnish_urls: []

#           # To pass options to the client charged with the request.
#           request_options: []

#     mercure:
#         # Enabled by default with installed GraphQL
#         enabled: false

#         # The URL sent in the Link HTTP header. If not set, will default to the URL for MercureBundle's default hub.
#         hub_url: null

#     messenger:
#         # Enabled by default with installed symfony/messenger and not installed symfony/symfony
#         enabled: false

#     elasticsearch:
#         # To enable or disable Elasticsearch support.
#         enabled: false

#         # The hosts to the Elasticsearch nodes.
#         hosts: []

#         # The mapping between resource classes and indexes.
#         mapping: []

#     # The list of exceptions mapped to their HTTP status code.
#     exception_to_status:
#         # With a status code.
#         Symfony\Component\Serializer\Exception\ExceptionInterface: 400

#         # Or with a constant defined in the 'Symfony\Component\HttpFoundation\Response' class.
#         ApiPlatform\Core\Exception\InvalidArgumentException: !php/const Symfony\Component\HttpFoundation\Response::HTTP_BAD_REQUEST

#         ApiPlatform\Core\Exception\FilterValidationException: 400

#         Doctrine\ORM\OptimisticLockException: 409

#         # ...

269 270 271 272 273 274 275 276 277 278
     # The list of enabled formats. The first one will be the default.
    formats:
         # jsonld:
         #    mime_types: ['application/ld+json']
        json:
            mime_types: ['application/json']
        # html:
        #     mime_types: ['text/html']
        csv:
            mime_types: ['text/csv']
Julien Jorry committed
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322

#         # ...

#     # The list of enabled patch formats. The first one will be the default.
#     patch_formats: []

#     # The list of enabled error formats. The first one will be the default.
#     error_formats:
#         jsonproblem:
#             mime_types: ['application/problem+json']

#         jsonld:
#             mime_types: ['application/ld+json']

#         # ...








# Exemples :
# App\Entity\Book:
#     itemOperations:
#         get:
#             method: 'GET'
#             path: '/grimoire/{id}'
#             requirements:
#                 id: '\d+'
#             defaults:
#                 color: 'brown'
#             host: '{subdomain}.api-platform.com'
#             schemes: ['https']
#             options:
#                 my_option: 'my_option_value'
#             status: 200 # customize the HTTP status code to send
#         put:
#             method: 'PUT'
#             path: '/grimoire/{id}/update'
#             hydra_context: { foo: 'bar' }
#             requirements:
#                 id: '\d+'