Learn by product

Select the product you would like help with:

Martini Logo
Select the product you would like help with:
Community Q&A

Ask the Community

I am working on a project now that parses yaml files. However I can't get the variables from it. I've tried sending the yaml via file and text/plain. What is the input property for this? Thank you.

Hi Julius Calalang,

As I understand, you were trying to pass a YAML file to your Gloop service. How does the YAML file gets passed? from a REST API or using file operations?

If you are passing it through a REST API, the input property of your exposed service must be a MultipartFile model. You can create one by using the content assist shortcut, and search for the Multipart keyword the next steps would be:
  • Convert the YAML file received to String by parsing the inputstream from the MultipartFile.
  • Using the service yamlStringToGloopObject,¬†convert your YAML string so that you can map it to a Gloop model (if you have generated a Gloop model from the YAML file/string already you can directly pass the parsed YAML string>Gloop object so that you can map it to that Gloop model)
  • Once finished with the conversion, you can now access whatever property/variable you want.
  • When exposing this service, make sure the MultipartFile model is set as FORM parameter. If you want your exposed REST API to return YAML, you must set the produces property to application/x-yaml

If you are trying to pass a YAML string, then do the following (read previous steps first):
  • Given that you are parsing the YAML string using yamlStringToGloopObject, set the String input property from your service as the body parameter of your exposed API.
  • Set the value of Consumes¬†field, with text/plain; charset=utf-8
  • if you want to see if your YAML model is properly populated with values provided from your yaml string input, make it as the response model on your Gloop REST API configuration