Skip to content

bugfix: duplicate properties (#276) #301

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Aug 4, 2017
Merged

bugfix: duplicate properties (#276) #301

merged 6 commits into from
Aug 4, 2017

Conversation

jenweber
Copy link
Contributor

Addresses #276

Whenever there are duplicate methods, the first one in the filtered list is the "most local," as far as I can see. If I'm reading the code right, it appears that this is how it was handled in the past as well.

One piece is missing: What would a good test be? It would be easy to write a test that asserts that there aren't duplicates, but I'm most concerned about the source data ordering changing somehow and that not being caught, resulting in the "less specific" documentation being shown. Suggestions? I can add a test before a merge. I'm PR'ing it now for easy testing/comparison/advice by a reviewer.

cc @sivakumar-kailasam @toddjordan

@sivakumar-kailasam
Copy link
Member

@jenweber Looking at a shorter version of the response data from server for json api adapter, one case where we see duplicates, it looks like we have an extra piece of information we could use to figure out the most local entity with confidence.

Short JSON API doc
{
  "data": {
    "id": "ember-data-2.14.6-DS.RESTAdapter",
    "type": "class",
    "attributes": {
      "extends": "DS.Adapter",
      "file": "addon/adapters/rest.js",
      "uses": [
        "DS.BuildURLMixin"
      ],
      "methods": [
        {
          "name": "createRecord",
          "file": "addon/adapters/rest.js"
        },
        {
          "name": "createRecord",
          "file": "addon/adapter.js"
        }
      ]
    },
    "relationships": {
      "parent-class": {
        "data": {
          "id": "ember-data-2.14.6-DS.Adapter",
          "type": "class"
        }
      },
      "descendants": {
        "data": [
          {
            "type": "class",
            "id": "ember-data-2.14.6-DS.JSONAPIAdapter"
          }
        ]
      },
      "module": {
        "data": {
          "id": "ember-data-2.14.6-ember-data",
          "type": "module"
        }
      },
      "project-version": {
        "data": {
          "id": "ember-data-2.14.6",
          "type": "project-version"
        }
      }
    }
  }
}

The module has a file attribute that is also present in the event/methods/properties model. May be grouping by name and picking the one with the same filename as module, if not the filename of the base class of the module & so on(unsure if this extended use case exists) might be more accurate.

On the matter of tests, may be an acceptance test would suffice. We could probably use the rest adapter or something similar to verify unique items & their sources (may be data-test-file to indicate their source?)

Sorry I couldn't put up this info sooner, hadn't investigated this issue until now 🙁

@locks locks temporarily deployed to ember-api-docs-staging-pr-301 July 28, 2017 06:53 Inactive
@locks locks temporarily deployed to ember-api-docs-staging-pr-301 July 31, 2017 04:25 Inactive
@sivakumar-kailasam sivakumar-kailasam temporarily deployed to ember-api-docs-staging-pr-301 July 31, 2017 04:56 Inactive
@jenweber
Copy link
Contributor Author

Don't merge yet. This needs another careful code review and a test.

@sivakumar-kailasam sivakumar-kailasam changed the title bugfix: duplicate properties (#276) [WIP] bugfix: duplicate properties (#276) Jul 31, 2017
@sivakumar-kailasam
Copy link
Member

@jenweber I merged from master so that we could see your changes on the review app. Added a WIP prefix to keep us from hitting that green button :)

@jenweber
Copy link
Contributor Author

@sivakumar-kailasam ok good, you were making me nervous, haha

@locks locks temporarily deployed to ember-api-docs-staging-pr-301 July 31, 2017 05:44 Inactive
@locks locks had a problem deploying to ember-api-docs-staging-pr-301 July 31, 2017 05:51 Failure
@locks locks temporarily deployed to ember-api-docs-staging-pr-301 August 3, 2017 12:33 Inactive
@sivakumar-kailasam
Copy link
Member

Let's ship it

@jenweber jenweber changed the title [WIP] bugfix: duplicate properties (#276) bugfix: duplicate properties (#276) Aug 3, 2017
@sivakumar-kailasam sivakumar-kailasam merged commit 61339a8 into ember-learn:master Aug 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants