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

Downloading / Publishing YAML removes quotes from strings #1447

Closed
matthew-muscat opened this issue Dec 23, 2019 · 11 comments
Closed

Downloading / Publishing YAML removes quotes from strings #1447

matthew-muscat opened this issue Dec 23, 2019 · 11 comments
Assignees

Comments

@matthew-muscat
Copy link

When downloading or publishing an project api specification, we're seeing previously quoted values being outputted without quotes.

This is in turn leading to a bug with the fields being incorrectly rendered in tooling such as redoc — which typically converts the YAML into a JSON object

A repeatable example can be seen over at https://onlineyamltools.com/convert-yaml-to-json using the following example payloads...

Quoted Date String

Priority Order request:
  value:
    order:
      courier_type: priority
      delivery_address: 1 Union Street
      delivery_postcode: "2009"
      delivery_state: NSW
      delivery_suburb: Pyrmont
      authority_to_leave: "Yes"
      delivery_date: "2016-07-26"
      delivery_window: 16:00-19:00
      parcel_attributes:
      - qty: 1
        weight: 2.1

— delivery_date results in displaying as "2016-07-26"

Unquoted Date String

Priority Order request:
  value:
    order:
      courier_type: priority
      delivery_address: 1 Union Street
      delivery_postcode: "2009"
      delivery_state: NSW
      delivery_suburb: Pyrmont
      authority_to_leave: "Yes"
      delivery_date: 2016-07-26
      delivery_window: 16:00-19:00
      parcel_attributes:
      - qty: 1
        weight: 2.1

— delivery_date results in displaying as "2016-07-26T00:00:00.000Z"

@EricWittmann
Copy link
Member

Thanks for the bug report. I'll have to dig into this one to see what options we have in our YAML library...

@teksuo
Copy link

teksuo commented Apr 19, 2021

Hi, any news or workaround on this? I uploaded a YAML using the Java client but the removal of quotes and braces makes the documentation tab not able to render(and the artifact useless).
Edit: Basically, if I upload it using the UI, I am able to download it as an InputStream and then convert it to YAML without an issue, what seems broken is the upload.
Thanks in advance

@EricWittmann
Copy link
Member

Can you confirm which project this actually impacts? From your most recent comment it sounds like this is a problem with Registry? You mention a Documentation tab, which suggests Registry rather than Studio.

@teksuo
Copy link

teksuo commented Apr 20, 2021 via email

@EricWittmann
Copy link
Member

OK no worries. I'm going to transfer this issue over to the Registry GitHub repository for tracking there.

@EricWittmann EricWittmann transferred this issue from Apicurio/apicurio-studio Apr 20, 2021
@EricWittmann
Copy link
Member

EricWittmann commented Apr 20, 2021

@carlesarnal can you have a look at this?

@carlesarnal
Copy link
Member

Hi @teksuo, first of all, which version of the Registry are you using? We recently released 2.0.0.Final with several changes to the rest client.

@teksuo
Copy link

teksuo commented Apr 21, 2021

Hi @carlesarnal , I am using the 1.3.2.Final, as it is the latest available in maven central:

https://mvnrepository.com/artifact/io.apicurio/apicurio-registry-rest-client

@carlesarnal
Copy link
Member

Hi @teksuo, take a look at this. The rest-client has been fully replaced by a new version using the JDK HTTP client. Could you give it a try?

Thanks!

@teksuo
Copy link

teksuo commented May 3, 2021

Hi @carlesarnal , I have switched the client version and updated the server, also set the new endpoint to ".../apis/registry/v2" as stated in the updated sample (although the docs seems to be still outdated). Current client code would be as simple as:

var client = RegistryClientFactory.create("http://<server_url>/apis/registry/v2); client.createArtifact(GROUP_ID, API_NAME, ArtifactType.OPENAPI, IfExists.RETURN, schema);

where schema is a validated InputStream from my yaml file.

The nice part is that now I can download exactly the same file I am uploading, although the rendering of the "documentation" tab still returns a blank page (which I can definitely live with).

Thanks a lot

@carlesarnal
Copy link
Member

Hi @teksuo, glad you fixed that problem with the client, since we have a persistent problem with the documentation tab, let's close this and open a new issue to track the progress for that. Could you please create it and describe the situation there? Thanks!

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

4 participants