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

Format Registry documentation is not accurate / well published #3789

Merged
merged 4 commits into from May 11, 2024

Conversation

Bellangelo
Copy link
Contributor

Closes #3703

i have changed the format of the base_type in the produced JSON to array for all the formats since I think we should be consistent with the property types between the formats.

@handrews handrews requested a review from a team May 8, 2024 13:56
Copy link
Contributor

@mikekistler mikekistler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is the potential for confusion here.

@@ -4,7 +4,7 @@ issue:
description: structured fields integer as defined in [RFC8941]
source: https://www.rfc-editor.org/rfc/rfc8941#name-integers
source_label: RFC 8941
base_type: integer, number
base_type: [integer, number]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this could create some confusion. The intent in this particular case is that the sf-integer format can be applied to either type: integer or type: number. Since OAS 3.1 the type value can be an array, so a reader might think that type: [integer, number] is the base type for this format.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on what we use more it looks like this is indeed the correct format. You can check also decimal and decimal128.

One more note, I am not so sure that the representations in these files are THAT important. The reason is that these files seem to just be for building the page and not for documentation. Which means that we mostly care for the end result and how the data will appear when rendered.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with this:

we mostly care for the end result and how the data will appear when rendered.

and thanks for the link to the decimal format because that shows how problematic the change actually is.

image

I would argue that this is not how we want the data to appear, so the array format just looks wrong to me.

If anything, I think we should be going the other direction, to make all these just a comma-separated string.

Copy link
Contributor Author

@Bellangelo Bellangelo May 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mikekistler That's what the PR fixes. They will appear as string, number. I don't fully agree that the users might be confused but if others agree with you we can change the others instead of the sf-integer

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Bellangelo I think what @mikekistler is getting at is that we just need the existing string, number to be rendered as string, numer, rather than rendering it as something that looks like a tuple with first a string and then a number.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @handrews and @mikekistler, I think there is a misunderstanding here, so I will try to explain the situation the best I can.
So, the line that @mikekistler commented on is a variable for the Liquid template engine that Jekyll uses. The reason why the sf-integer and the decimal appear different is that the sf-integer sets the variable type to a string, while the other to an array. Liquid by default joins array's item together without any separator. This is solved by this line which overrides the default behavior and instead uses the separator that we want, a comma with a space.
Did you test it and had different results?

While we could easily just use the string instead, so keeping the sf-integer as is and changing the rest, the reason I persist on this is that it feels kind of weird to me that the produced JSON would have a base_type which is a string but it contains actually 2 values.
From this point, there are 2 ways to go to:

  1. You agree with the point i made on the JSON part: Then if we keep the variable type as a string we would need to create a more complex filter as we would need to split the string and generate a valid JSON array.
  2. You don't agree with the point I made on the JSON part: Then I revert the changes on how we produce the JSON and I change every format that uses an array.
  3. Of course, there is a secret 3rd option which you can just suggest something that i missed.

PS. Sorry for insisting on a minor issue.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Bellangelo Ah, yes I see, thank you for clarifying! I agree that sf-integer should be an array here, (matching how it is in decimal, for example). I got confused thinking that all of the others did not wrap that list in an array. But they do. My apologies! I read through this too quickly.

@mikekistler I think this is correct, or at least it's the same as the other formats that use either of two types. If this isn't the way we want to structure type alternative lists, we should probably sort that out separately from this bugfix.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the extended explanation @Bellangelo! This looks good then.

Copy link
Contributor

@mikekistler mikekistler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! 👍

Thanks for the fix!

@handrews handrews merged commit e14e81d into OAI:gh-pages May 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants