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

Add source reference on Envelope.parameterType #2719

Closed
jkronegg opened this issue Mar 31, 2023 · 2 comments · Fixed by #2739
Closed

Add source reference on Envelope.parameterType #2719

jkronegg opened this issue Mar 31, 2023 · 2 comments · Fixed by #2739
Assignees
Labels
⚡ enhancement Request for new functionality

Comments

@jkronegg
Copy link
Contributor

jkronegg commented Mar 31, 2023

🤔 What's the problem you're trying to solve?

When implementing a plugin, I can determine the source reference of a Step Definition (using handler on Envelope.stepDefinition), but I cannot determine the source reference for a ParameterType.

The cause is CachingGlue.emitParameterTypeDefined which creates an Envelope with a ParameterType which miss the source reference information.

✨ What's your proposed solution?

A simple solution would be to:

  • add a SourceReference in the io.cucumber.messages.types.ParameterType. Hint: requires changing the cucumber messages schema (https://github.com/cucumber/messages/tree/main/jsonschema) which generates classes for Java and other languages, see Add the SourceReference in ParameterType messages#145. A snapshot version of the library should be made.
  • fill this source reference field with the Java method similarly to what is done in io.cucumber.messages.types.StepDefinition (in this case: based on the io.cucumber.cucumberexpressions.ParameterType which contains the Java Method). Hint: the cucumber messages snapshot library should be used in the PR
  • Create an issue in each supported language repo (ruby, js) : done, see mentions in the issue history below.

⛏ Have you considered any alternatives or workarounds?

The ParameterType can be obtained by looking at all methods annotated @ParameterType on all classes of the classpath, but this is not really efficient.

@jkronegg jkronegg added the ⚡ enhancement Request for new functionality label Mar 31, 2023
@mpkorstanje
Copy link
Contributor

mpkorstanje commented Mar 31, 2023

Seems acceptable. The message protocol must be updated to include this information. Messages are generated from a schema definition in https://github.com/cucumber/messages.

@mpkorstanje
Copy link
Contributor

@jkronegg you can branch of from #2727.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⚡ enhancement Request for new functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants