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

Follow up: Regex properties on non-string types #1368

Closed
industrian opened this issue Sep 21, 2022 · 4 comments · Fixed by #1959
Closed

Follow up: Regex properties on non-string types #1368

industrian opened this issue Sep 21, 2022 · 4 comments · Fixed by #1959
Assignees
Labels
🚀 Status: Groomed All is known to start development 🐛 Type: Bug Something isn't working

Comments

@industrian
Copy link

Original issue: #1357

In a recent update, this functionality was added to the kit.

The description in a work-in-progress document appears to be "off" though:

It's "Array of Any object property matching this regular expression" when it should be "Array of Suggestion":

image

image

This was discussed at the Team weekly on 21 September.

@gabriele-ct
Copy link
Contributor

Looking at api-specs/history/types/common/SearchKeywords.raml
seems that the expected structure is like this:

#%RAML 1.0 DataType
(package): Common
type: object
displayName: SearchKeywords
description:
properties:
  /^[a-z]{2}(-[A-Z]{2})?$/:
    type: array
    items:
      type: SearchKeyword

Could @industrian please check if the actual Product definition in api-specs/api/types/product/SuggestionResult.raml is correct of is missing the type property

@gabriele-ct gabriele-ct added the 🚀 Status: Groomed All is known to start development label Sep 7, 2023
@industrian
Copy link
Author

Looking at api-specs/history/types/common/SearchKeywords.raml seems that the expected structure is like this:

#%RAML 1.0 DataType
(package): Common
type: object
displayName: SearchKeywords
description:
properties:
  /^[a-z]{2}(-[A-Z]{2})?$/:
    type: array
    items:
      type: SearchKeyword

Could @industrian please check if the actual Product definition in api-specs/api/types/product/SuggestionResult.raml is correct of is missing the type property

I tested the following and got the same result.

#%RAML 1.0 DataType
(package): Product
(docs-uri): https://docs.commercetools.com/api/projects/products-suggestions#suggestionresult
displayName: SuggestionResult
type: object
properties:
  /searchKeywords.[a-z]{2}(-[A-Z]{2})?/:
    type: array
    items:
      type: Suggestion

Screenshot 2024-01-19 at 13 12 39

@stmeissner
Copy link

stmeissner commented Jan 23, 2024

@gabriele-ct In particular it's in file /api-specs/api/types/product/SuggestionResult.raml

#%RAML 1.0 DataType
(package): Product
displayName: SuggestionResult
type: object
properties:
  /searchKeywords.[a-z]{2}(-[A-Z]{2})?/:
    type: array
    items: Suggestion
    description: Results of a suggestion.

What we would like to have is

Array of Suggestion

with Suggestion being a link to the rendered type.

Currently we are getting

Array of Any object property matching this regular expression.

@FFawzy FFawzy added the 🐛 Type: Bug Something isn't working label Jan 25, 2024
@timonrey
Copy link
Contributor

timonrey commented Jan 25, 2024

ramldoc output for this case:

#%RAML 1.0 DataType
displayName: SuggestionResult
type: object
(builtinType): object
(package): "Product"
(docs-uri): "https://docs.commercetools.com/http-api-projects-products-suggestions.html#suggestionresult"
properties:
  /searchKeywords.[a-z]{2}(-[A-Z]{2})?/:
    type: array
    items:
      type: Suggestion
    (builtinType): array
    required: true
    (inherited): false

We need to apply the same logic for the regex types as we do for the other types to display the right type.
Link to the code:

? `Any ${typeof typeToRender.type} property matching this regular expression`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚀 Status: Groomed All is known to start development 🐛 Type: Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants