Skip to content
This repository was archived by the owner on Jan 21, 2024. It is now read-only.

Fixes #29: Make getDeclarationByName work with type expressions #30

Merged
merged 11 commits into from
Jul 19, 2019

Conversation

postatum
Copy link
Contributor

Fixes #29

Things that need to be done after changes of this PR are released:

  • generate js and java docs in master
  • describe breaking changes in a release description

Breaking changes

This PR presents potentially breaking changes for Java users. In particular WebApiBaseUnit.getDeclarationByName now returns an instance of amf.client.model.domain.AnyShape instead of amf.client.model.domain.NodeShape. Note that NodeShape is a subclass of AnyShape as API docs state.

Considering this, you might need to explicitly convert an instance of AnyShape returned by WebApiBaseUnit.getDeclarationByName to its subclasses to access subclass-specific properties.

E.g. to access UnionShape.anyOf property you would have to do:

UnionShape user = (UnionShape) model.getDeclarationByName("User");
System.out.println(user.anyOf());

JS users should face no breaking changes.

@postatum postatum requested a review from jstoiko July 12, 2019 09:01
@postatum
Copy link
Contributor Author

This PR needs to be updated a little. getDeclarationByName doesn't return scalar types. E.g.

  CatBreed:
    type: string

@postatum postatum changed the title Fixes #29: Make getDeclarationByName work with type expressions (WIP) Fixes #29: Make getDeclarationByName work with type expressions Jul 18, 2019
@@ -27,8 +27,8 @@ val settings = Common.settings ++ Common.publish ++ Seq(
credentials ++= Common.credentials(),
libraryDependencies ++= Seq(
"org.scalatest" %%% "scalatest" % "3.0.5" % "test",
"com.github.amlorg" %%% "amf-webapi" % "3.2.1",
"com.github.amlorg" %%% "amf-validation" % "3.2.1"
"com.github.amlorg" %%% "amf-webapi" % "3.2.2",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

latest is 3.3.0

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jstoiko can we make this upgrade in a separate PR?
Release 3.3.0 adds breaking changes (section "Interface Changes") which may break things in webapi-parser code and/or examples. There will be too much in this PR if we fix migration issues here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also see aml-org/amf#542

@postatum
Copy link
Contributor Author

Done reworking the PR. WebApiBaseUnit.getDeclarationByName should now return all valid RAML 1.0 type declarations.

@postatum postatum requested a review from jstoiko July 19, 2019 07:30
@postatum postatum changed the title (WIP) Fixes #29: Make getDeclarationByName work with type expressions Fixes #29: Make getDeclarationByName work with type expressions Jul 19, 2019
Copy link
Contributor

@jstoiko jstoiko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm glad you added tests and encovered a new bug (the one you reported in AMF). Good catch!

@jstoiko jstoiko merged commit e165117 into develop Jul 19, 2019
@jstoiko jstoiko deleted the i29_getDeclarationByName_expressions branch July 19, 2019 23:12
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants