8000 Merge branch 'release/3.3.0' into main · rubinred/laravel-json-api@3024714 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3024714

Browse files
committed
Merge branch 'release/3.3.0' into main
2 parents 2189d7d + 39946e7 commit 3024714

File tree

388 files changed

+2423
-1063
lines changed
  • Jobs
  • JsonApi
  • Policies
  • Providers
  • config
  • database
  • routes
  • tests
  • lib
  • package
  • Some content is hidden

    Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

    388 files changed

    +2423
    -1063
    lines changed

    .github/workflows/tests.yml

    Lines changed: 43 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -0,0 +1,43 @@
    1+
    name: Tests
    2+
    3+
    on:
    4+
    push:
    5+
    branches: [ main, develop ]
    6+
    pull_request:
    7+
    branches: [ main, develop ]
    8+
    9+
    jobs:
    10+
    build:
    11+
    12+
    runs-on: ubuntu-latest
    13+
    14+
    strategy:
    15+
    fail-fast: true
    16+
    matrix:
    17+
    php: ['7.3', '7.4', '8.0']
    18+
    laravel: ['^8.0']
    19+
    20+
    steps:
    21+
    - name: Checkout Code
    22+
    uses: actions/checkout@v2
    23+
    24+
    - name: Setup PHP
    25+
    uses: shivammathur/setup-php@v2
    26+
    with:
    27+
    php-version: ${{ matrix.php }}
    28+
    extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, gd
    29+
    tools: composer:v2
    30+
    coverage: none
    31+
    32+
    - name: Set Laravel Version
    33+
    run: composer require "laravel/framework:${{ matrix.laravel }}" --no-update -n
    34+
    35+
    - name: Install dependencies
    36+
    uses: nick-invision/retry@v1
    37+
    with:
    38+
    timeout_minutes: 5
    39+
    max_attempts: 5
    40+
    command: composer install --no-suggest --prefer-dist -n -o
    41+
    42+
    - name: Execute tests
    43+
    run: vendor/bin/phpunit

    .travis.yml

    Lines changed: 0 additions & 26 deletions
    This file was deleted.

    CHANGELOG.md

    Lines changed: 347 additions & 278 deletions
    Large diffs are not rendered by default.

    README.md

    Lines changed: 26 additions & 15 deletions
    Original file line numberDiff line numberDiff line change
    @@ -1,7 +1,23 @@
    1-
    [![Build Status](https://travis-ci.org/cloudcreativity/laravel-json-api.svg?branch=master)](https://travis-ci.org/cloudcreativity/laravel-json-api)
    1+
    ![Tests](https://github.com/cloudcreativity/laravel-json-api/workflows/Tests/badge.svg)
    22

    33
    # cloudcreativity/laravel-json-api
    44

    5+
    ## Status
    6+
    7+
    **This package has now been rewritten, substantially improved and released as the `laravel-json-api/laravel` package.**
    8+
    Documentation for the new version is available on our new website [laraveljsonapi.io](https://laraveljsonapi.io) and the
    9+
    code is now developed under the
    10+
    [Laravel JSON:API Github organisation.](https://github.com/laravel-json-api)
    11+
    12+
    The `cloudcreativity/laravel-json-api` package is now considered to be the *legacy* package. As we know it is in use in
    13+
    a lot of production applications, it will continue to receive bug fixes and updates for new Laravel versions. However,
    14+
    it is no longer supported for new features.
    15+
    16+
    **If you are starting a new project, please use the
    17+
    [new package `laravel-json-api/laravel` instead.](https://github.com/laravel-json-api/laravel)**
    18+
    19+
    ## Introduction
    20+
    521
    Build feature-rich and standards-compliant APIs in Laravel.
    622

    723
    This package provides all the capabilities you need to add [JSON API](http://jsonapi.org)
    @@ -38,11 +54,11 @@ The following additional features are also supported:
    3854
    From [jsonapi.org](http://jsonapi.org)
    3955

    4056
    > If you've ever argued with your team about the way your JSON responses should be formatted, JSON API is your
    41-
    anti-bikeshedding weapon.
    57+
    > anti-bikeshedding weapon.
    4258
    >
    43-
    > By following shared conventions, you can increase productivity, take advantage of generalized tooling, and focus
    44-
    on what matters: your application. Clients built around JSON API are able to take advantage of its features around
    45-
    efficiently caching responses, sometimes eliminating network requests entirely.
    59+
    > By following shared conventions, you can increase productivity, take advantage of generalized tooling, and focus on
    60+
    > what matters: your application. Clients built around JSON API are able to take advantage of its features around
    61+
    > efficiently caching responses, sometimes eliminating network requests entirely.
    4662
    4763
    For full information on the spec, plus examples, see [http://jsonapi.org](http://jsonapi.org).
    4864

    @@ -54,9 +70,10 @@ Want a tutorial to get started? Read the
    5470
    Full package documentation is available on
    5571
    [Read the Docs](http://laravel-json-api.readthedocs.io/en/latest/).
    5672

    57-
    ## Demo
    73+
    ## Slack
    5874

    59-
    A demo application is available at [here](https://github.com/cloudcreativity/demo-laravel-json-api).
    75+
    Join the Laravel JSON:API community on
    76+
    [Slack.](https://join.slack.com/t/laraveljsonapi/shared_invite/zt-e3oi2r4y-8nkmhzpKnPQViaXrkPJHtQ)
    6077

    6178
    ## Laravel Versions
    6279

    @@ -73,12 +90,6 @@ A demo application is available at [here](https://github.com/cloudcreativity/dem
    7390
    Make sure you consult the [Upgrade Guide](http://laravel-json-api.readthedocs.io/en/latest/upgrade/)
    7491
    when upgrading between major or pre-release versions.
    7592

    76-
    ## Lumen
    77-
    78-
    Currently we have not integrated the package with Lumen. We do not have any active projects that use Lumen,
    79-
    so if you do and can help, please let us know on
    80-
    [this issue](https://github.com/cloudcreativity/laravel-json-api/issues/61).
    81-
    8293
    ## License
    8394

    8495
    Apache License (Version 2.0). Please see [License File](LICENSE) for more information.
    @@ -89,8 +100,8 @@ Installation is via `composer`. See the documentation for complete instructions.
    89100

    90101
    ## Contributing
    91102

    92-
    Contributions are absolutely welcome. Ideally submit a pull request, even more ideally with unit tests.
    93-
    Please note the following:
    103+
    Contributions are absolutely welcome. Ideally submit a pull request, even more ideally with unit tests. Please note the
    104+
    following:
    94105

    95106
    - **Bug Fixes** - submit a pull request against the `master` branch.
    96107
    - **Enhancements / New Features** - submit a pull request against the `develop` branch.

    database/migrations/2018_10_23_000001_create_client_jobs_table.php

    Lines changed: 2 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -1,6 +1,6 @@
    11
    <?php
    2-
    /**
    3-
    * Copyright 2020 Cloud Creativity Limited
    2+
    /*
    3+
    * Copyright 2021 Cloud Creativity Limited
    44
    *
    55
    * Licensed under the Apache License, Version 2.0 (the "License");
    66
    * you may not use this file except in compliance with the License.

    docs/basics/adapters.md

    Lines changed: 4 additions & 3 deletions
    Original file line numberDiff line numberDiff line change
    @@ -233,7 +233,8 @@ for Eloquent models. The relationship types available are `belongsTo`, `hasOne`,
    233233
    | `morphOne` | `hasOne` |
    234234
    | `morphMany` | `hasMany` |
    235235
    | `morphToMany` | `hasMany` |
    236-
    | `morphedByMany` | `morphMany` |
    236+
    | `morphedByMany` | `hasMany` |
    237+
    | n/a | `morphMany` |
    237238
    | n/a | `queriesOne` |
    238239
    | n/a | `queriesMany` |
    239240

    @@ -380,8 +381,8 @@ class Adapter extends AbstractAdapter
    380381

    381382
    #### Morph-Many
    382383

    383-
    Use the JSON API `morphMany` relation for an Eloquent `morphedByMany` relation. The `morphMany` relation in effect
    384-
    *mixes* multiple different JSON API resource relationships in a single relationship.
    384+
    Use the JSON API `morphMany` relation to *mix* multiple different JSON API resource relationships in a single
    385+
    relationship.
    385386

    386387
    This is best demonstrated with an example. If our application has a `tags` resource that can be linked to either
    387388
    `videos` or `posts`, our `tags` adapter would define a `taggables` relation as follows:

    helpers.php

    Lines changed: 2 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -1,6 +1,6 @@
    11
    <?php
    2-
    /**
    3-
    * Copyright 2020 Cloud Creativity Limited
    2+
    /*
    3+
    * Copyright 2021 Cloud Creativity Limited
    44
    *
    55
    * Licensed under the Apache License, Version 2.0 (the "License");
    66
    * you may not use this file except in compliance with the License.

    resources/lang/en/errors.php

    Lines changed: 2 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -1,6 +1,6 @@
    11
    <?php
    2-
    /**
    3-
    * Copyright 2020 Cloud Creativity Limited
    2+
    /*
    3+
    * Copyright 2021 Cloud Creativity Limited
    44
    *
    55
    * Licensed under the Apache License, Version 2.0 (the "License");
    66
    * you may not use this file except in compliance with the License.

    resources/lang/en/validation.php

    Lines changed: 2 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -1,6 +1,6 @@
    11
    <?php
    2-
    /**
    3-
    * Copyright 2020 Cloud Creativity Limited
    2+
    /*
    3+
    * Copyright 2021 Cloud Creativity Limited
    44
    *
    55
    * Licensed under the Apache License, Version 2.0 (the "License");
    66
    * you may not use this file except in compliance with the License.

    resources/lang/fr/errors.php

    Lines changed: 156 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -0,0 +1,156 @@
    1+
    <?php
    2+
    /*
    3+
    * Copyright 2021 Cloud Creativity Limited
    4+
    *
    5+
    * Licensed under the Apache License, Version 2.0 (the "License");
    6+
    * you may not use this file except in compliance with the License.
    7+
    * You may obtain a copy of the License at
    8+
    *
    9+
    * http://www.apache.org/licenses/LICENSE-2.0
    10+
    *
    11+
    * Unless required by applicable law or agreed to in writing, software
    12+
    * distributed under the License is distributed on an "AS IS" BASIS,
    13+
    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14+
    * See the License for the specific language governing permissions and
    15+
    * limitations under the License.
    16+
    */
    17+
    18+
    return [
    19+
    20+
    /*
    21+
    |--------------------------------------------------------------------------
    22+
    | Error Object Language Lines
    23+
    |--------------------------------------------------------------------------
    24+
    |
    25+
    | The following language lines contain the default translatable members
    26+
    | of JSON API error objects. According to the JSON API spec, the
    27+
    | `title` and `detail` members can be localized. In addition the `code`
    28+
    | member is also read from this package if you want to give the error
    29+
    | a specific code.
    30+
    |
    31+
    | Set any value to an empty string if you do not want the member to be
    32+
    | included in the error object.
    33+
    |
    34+
    | @see http://jsonapi.org/format/#errors
    35+
    */
    36+
    37+
    'unauthorized' => [
    38+
    'title' => 'Non authentifié',
    39+
    'detail' => '',
    40+
    'code' => '',
    41+
    ],
    42+
    43+
    'forbidden' => [
    44+
    'title' => 'Non autorisé',
    45+
    'detail' => '',
    46+
    'code' => '',
    47+
    ],
    48+
    49+
    'token_mismatch' => [
    50+
    'title' => 'Jeton invalide',
    51+
    'detail' => "Le jeton n'est pas valide.",
    52+
    'code' => '',
    53+
    ],
    54+
    55+
    'member_required' => [
    56+
    'title' => 'Document JSON API invalide',
    57+
    'detail' => 'Le membre :member est obligatoire.',
    58+
    'code' => '',
    59+
    ],
    60+
    61+
    'member_object_expected' => [
    62+
    'title' => 'Document JSON API invalide',
    63+
    'detail' => 'Le membre :member doit être un objet.',
    64+
    'code' => '',
    65+
    ],
    66+
    67+
    'member_identifier_expected' => [
    68+
    'title' => 'Document JSON API invalide',
    69+
    'detail' => 'Le membre :member doit être un identifiant de ressource.',
    70+
    'code' => '',
    71+
    ],
    72+
    73+
    'member_string_expected' => [
    74+
    'title' => 'Document JSON API invalide',
    75+
    'detail' => 'Le membre :member doit être une chaîne de caractères.',
    76+
    'code' => '',
    77+
    ],
    78+
    79+
    'member_empty' => [
    80+
    'title' => 'Document JSON API invalide',
    81+
    'detail' => 'Le membre :member ne peut être vide.',
    82+
    'code' => '',
    83+
    ],
    84+
    85+
    'member_field_not_allowed' => [
    86+
    'title' => 'Document JSON API invalide',
    87+
    'detail' => 'Le membre :member ne peut avoir de champ :field.',
    88+
    'code' => '',
    89+
    ],
    90+
    91+
    'resource_type_not_supported' => [
    92+
    'title' => 'Non supporté',
    93+
    'detail' => "Le type de ressource :type n'est pas supporté par ce endpoint.",
    94+
    'code' => '',
    95+
    ],
    96+
    97+
    'resource_type_not_recognised' => [
    98+
    'title' => 'Non supporté',
    99+
    'detail' => "Le type de ressource :type n'est pas reconnu.",
    100+
    'code' => '',
    101+
    ],
    102+
    103+
    'resource_id_not_supported' => [
    104+
    'title' => 'Non supporté',
    105+
    'detail' => "L'identifiant de ressource :id n'est pas supporté par ce endpoint.",
    106+
    'code' => '',
    107+
    ],
    108+
    109+
    'resource_client_ids_not_supported' => [
    110+
    'title' => 'Non supporté',
    111+
    'detail' => "Le type de ressource :type n'accepte pas les identifiants générés par le client.",
    112+
    'code' => '',
    113+
    ],
    114+
    115+
    'resource_exists' => [
    116+
    'title' => 'Conflit',
    117+
    'detail' => 'La ressource :id existe déjà.',
    118+
    'code' => '',
    119+
    ],
    120+
    121+
    'resource_not_found' => [
    122+
    'title' => 'Introuvable',
    123+
    'detail' => "La ressource spécifiée n'existe pas.",
    124+
    'code' => '',
    125+
    ],
    126+
    127+
    'resource_field_exists_in_attributes_and_relationships' => [
    128+
    'title' => "Document JSON API invalide",
    129+
    'detail' => 'Le champ :field ne peut être à la fois un attribut et une relation.',
    130+
    'code' => '',
    131+
    ],
    132+
    133+
    'resource_invalid' => [
    134+
    'title' => 'Entité non traitable',
    135+
    'detail' => 'Le document est correctement structuré mais contient des erreurs sémantiques.',
    136+
    'code' => '',
    137+
    ],
    138+
    139+
    'resource_cannot_be_deleted' => [
    140+
    'title' => 'Non supprimable',
    141+
    'detail' => 'La ressource ne peut être supprimée.',
    142+
    'code' => '',
    143+
    ],
    144+
    145+
    'query_invalid' => [
    146+
    'title' => 'Paramètre de requête invalide',
    147+
    'detail' => 'Les paramètres de la requête ne sont pas valides.',
    148+
    'code' => '',
    149+
    ],
    150+
    151+
    'failed_validator' => [
    152+
    'title' => 'Entité non traitable',
    153+
    'detail' => 'Le document est correctement structuré mais contient des erreurs sémantiques.',
    154+
    'code' => '',
    155+
    ],
    156+
    ];

    0 commit comments

    Comments
     (0)
    0