Skip to content
This repository has been archived by the owner on Sep 18, 2019. It is now read-only.

Preserve snake_case while generating service spec jsons #10

Merged
merged 2 commits into from
Feb 28, 2019

Conversation

raamb
Copy link
Member

@raamb raamb commented Feb 5, 2019

As reported by Abdulrahman Semrie

Hi everyone. So I was having issues with testing of the moses-service and annotation-service through the dApp lately. After much debugging, I found out the issue occurs when there is an underscore in a field name of a message in the *proto* definition of the service. In this case, the DApp sends an empty string for that field and this will trigger an error on the service side. To reproduce the issue  I have deployed two versions of the annotation service. The first which is named *annotation-service* has an underscore in the field names and it fails with an error. The second one named *annotation-service-test* has no underscore in any of the field names and it works as expected.

Here are the model hash for the services:
   - annotation-service: `-----------------------------------`
   - annotation-service-test: `---------------------------------`

This issue occurs only from the dApp and it works fine from the `snet cli`.

The DApp get the service definition from this service which in turn uses protobuf to load the proto files. Protobufjs by default converts snake_case to camelCase. See protobufjs/protobuf.js#564

In order to preserve case, proposing to set the global flag on protobufjs as described protobufjs/protobuf.js#608

@vforvalerio87 @tesYolan

@raamb raamb requested a review from vforvalerio87 February 5, 2019 08:25
@raamb raamb merged commit 9ceb64f into singnet:master Feb 28, 2019
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.

1 participant