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

The return type (schema) of the postTagByProject method is Branch instead of Tag #10

Open
csanadtelbisz opened this issue Jul 26, 2022 · 0 comments

Comments

@csanadtelbisz
Copy link

The return type (schema) of the postTagByProject method is Branch instead of Tag. This leads to several issues in the generated files, too. See: openapi.yaml.

SysML v2 API Java client version: 2021-09 (commit: Merge branch 'release/2021-09' on Oct 15, 2021)

Steps to reproduce:

  • Using the api client, create a project and a commit.
  • Send a request to post a tag pointing to the created commit.

The following simple project reproduces the problem: api-client-bug-report.zip. Essential part:

val projectApi = ProjectApi(defaultClient)
val commitApi = CommitApi(defaultClient)
val tagApi = TagApi(defaultClient)
//...
val project = projectApi.postProject(Project().apply {
    name = "demo project"
})
val commit = commitApi.postCommitByProject(project.atId, Commit(), null) // An empty commit is added
tagApi.postTagByProject(project.atId, Tag().apply {
    name = "my_tag"
    taggedCommit = BranchHead().atId(commit.atId)
}) // Exception: Unexpected value 'Tag'

Expected output: the posted tag is returned.

Actual output: the pilot server implementation correctly returns a Tag which results in an exception when the client deserializes the result (because a Branch is expected).
Stack trace:

Exception in thread "main" java.lang.IllegalArgumentException: Unexpected value 'Tag'
	at org.omg.sysml.model.Branch$AtTypeEnum.fromValue(Branch.java:68)
	at org.omg.sysml.model.Branch$AtTypeEnum$Adapter.read(Branch.java:80)
	at org.omg.sysml.model.Branch$AtTypeEnum$Adapter.read(Branch.java:71)
	at com.google.gson.TypeAdapter$1.read(TypeAdapter.java:199)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:131)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:222)
	at com.google.gson.Gson.fromJson(Gson.java:932)
	at com.google.gson.Gson.fromJson(Gson.java:897)
	at com.google.gson.Gson.fromJson(Gson.java:846)
	at org.omg.sysml.JSON.deserialize(JSON.java:163)
	at org.omg.sysml.ApiClient.deserialize(ApiClient.java:775)
	at org.omg.sysml.ApiClient.handleResponse(ApiClient.java:978)
	at org.omg.sysml.ApiClient.execute(ApiClient.java:905)
	at org.omg.sysml.api.TagApi.postTagByProjectWithHttpInfo(TagApi.java:590)
	at org.omg.sysml.api.TagApi.postTagByProject(TagApi.java:567)
	at MainKt.main(Main.kt:24)
	at MainKt.main(Main.kt)
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

No branches or pull requests

1 participant