Skip to content
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

feat/complex-x-ts-types - Adds supports for using x-ts-type in anyOf, allOf, oneOf, and not keywords #4479

Merged
merged 1 commit into from
Jan 27, 2020

Conversation

mschnee
Copy link
Contributor

@mschnee mschnee commented Jan 22, 2020

Partially implements: #4300
See: #4406

This has been split from #4406 as a more manageable, smaller PR.

Added

This PR adds support for using x-ts-type schema bodies the value of anyOf, allOf, oneOf, and not schema object keys, as described by the OpenAPI Schema Object specification. In this example ResponseObject:

{
  description: 'Path Response Description',
  content: {
    'application/json': {
      schema: {
        anyOf: [
          { 'x-ts-type': CouldBeThisModel },
          { 'x-ts-type': OrThisModel } 
        ],
        not: { 'x-ts-type': ButNotThisModel }
      }
    }
  }
}

Checklist

  • npm test passes on your machine
  • New tests added or existing tests modified to cover all changes
  • Code conforms with the style guide
  • API Documentation in code was updated
  • Documentation in /docs/site was updated
  • (n/a) Affected artifact templates in packages/cli were updated
  • Affected example projects in examples/* were updated

@mschnee mschnee changed the title Feat/complex x ts types feat/complex-x-ts-types - Adds supports for using x-ts-type in anyOf, allOf, oneOf, and not keywords Jan 22, 2020
@mschnee mschnee force-pushed the feat/complex-x-ts-types branch from 1d5f452 to b21092e Compare January 22, 2020 03:19
@mschnee
Copy link
Contributor Author

mschnee commented Jan 22, 2020

NOTE I've rebased and force-pushed my branch. I hope that addresses the travis-commitlint build errors, as I think that may have come in from pulling upstream.

@dhmlau
Copy link
Member

dhmlau commented Jan 22, 2020

FYI - the drop in test coverage is in the examples package which I don't think it's related to the changes in this PR.

@mschnee
Copy link
Contributor Author

mschnee commented Jan 22, 2020

$ source cloudant-config.sh && npm run mocha
/home/travis/.travis/functions: line 109: cloudant-config.sh: No such file or directory

:/

I'd love a little assistance in addressing this failing test. I don't believe the changes in this PR had any impact on the cloudant tests.

@raymondfeng
Copy link
Contributor

@mschnee Please ignore the cloudant issue.

@mschnee
Copy link
Contributor Author

mschnee commented Jan 23, 2020

I will update the documentation referring to x-ts-type to be more explicit about anyOf/allOf/oneOf/not tomorrow.

@mschnee
Copy link
Contributor Author

mschnee commented Jan 23, 2020

Document updated :)

@raymondfeng
Copy link
Contributor

@mschnee Please rebase your branch to latest master to pass CI tests.

@raymondfeng
Copy link
Contributor

@mschnee Please follows instructions at https://loopback.io/doc/en/lb4/submitting_a_pr.html#6-rebasing for rebasing.

@mschnee mschnee force-pushed the feat/complex-x-ts-types branch from 88bca90 to 29c5a05 Compare January 24, 2020 18:05
package.json Outdated Show resolved Hide resolved
@mschnee
Copy link
Contributor Author

mschnee commented Jan 24, 2020

Rebase complete! :)

@raymondfeng
Copy link
Contributor

@mschnee Thank you for cleaning up the PR. One last step - please squash two commits into one per instructions at https://loopback.io/doc/en/lb4/submitting_a_pr.html#10-final-rebase-and-squashing-of-commits.

@mschnee mschnee force-pushed the feat/complex-x-ts-types branch from fa8b182 to 6594975 Compare January 25, 2020 00:13
@mschnee mschnee force-pushed the feat/complex-x-ts-types branch from 6594975 to 0c885e9 Compare January 27, 2020 16:36
@mschnee
Copy link
Contributor Author

mschnee commented Jan 27, 2020

Rebased off of master this morning again and pushed :)

@raymondfeng raymondfeng merged commit 28fcc54 into loopbackio:master Jan 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants