-
Notifications
You must be signed in to change notification settings - Fork 82
Fix RAML syntax #2042
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
Merged
Merged
Fix RAML syntax #2042
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
`AttributeGroupCreate` got no `languages` property. - No `languages` is parsed in https://github.com/ibexa/product-catalog/blob/main/src/bundle/REST/Input/Parser/AttributeGroupCreate.php - No `languages` in examples/product/catalog/attribute_groups/POST/AttributeGroupCreate.json.example
Language is only used in response to GET /languages/{code} or GET /languages (see docs/api/rest_api/rest_api_reference/input/ez-languages.raml)
The Language::ALL constant can't be used in REST
It comes from https://github.com/ibexa/core/blob/main/src/contracts/Repository/Values/Content/Language.php#L26
Language has no REST input parser.
Language's output parser never use ALL (see https://github.com/ibexa/rest/blob/main/src/lib/Server/Output/ValueObjectVisitor/Language.php)
Old language system uses Value; newer uses an object with language codes as properties/keys.
konradoboza
approved these changes
Jul 6, 2023
7 tasks
MagdalenaZuba
approved these changes
Jul 6, 2023
adriendupuis
added a commit
that referenced
this pull request
Jul 7, 2023
Steveb-p
approved these changes
Jul 7, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
RAML syntax
Disrespect of those rules generates errors when using a more recent RAML parser (see #1871).
Array items typing
I set
items: mixedwhen I wasn't able to identify the expected types for the property items.There is no associative arrays in JSON, only objects. Several arrays were in fact objects.
For
namesanddescriptionsproperties, there are two ways:type: Value[]for the old way;ObjectStateGroupexamples:type: objectfor the new way;PaymentMethodUpdateStructexampleI do not know how to describe the property of this object as their keys are dynamics, they depends on client's needed languages.
What is the way to write this in XML?
Some types aren't used an may not need further investigation. "Unused" means that there is no REST route declaring
type: <type>in itsbodyorresponses("direct usage"), and there is no used other type using it for its properties ("indirect usage").Updated types
ContentTypeUpdateStruct(unused)CreateStruct(unused)Criterion: Couldvaluesbe more detailed thanitems: mixed?FieldDefinitionCreateStruct(unused)FieldDefinitionUpdateStruct(unused)Language: constantALLcan't be a part of the responseMessage(unused)Notification(unused)Plural(unused)UrlAlias:pathproperty typed asstring.ValueObject(unused)ContentTypeCreate:namesanddescriptionsareValue[](see ContentTypeCreate.xml.example).ContentTypeUpdate:namesanddescriptionsareValue[].CatalogCreate:namesanddescriptionsareobject(see CatalogCreate.json.example).CatalogUpdate:namesanddescriptionsareobject.AttributeGroupCreate: there is nolanguagesproperty; Even if the parsed value has it, the input parser doesn't treat it.AttributeGroupUpdate: idem.Attribute:optionsseems to be an object; the main example has an empty array butProductVariantexample use an object asoptionsin itsDiscriminatorAttributesList; classes may help:Attribute←AttributeDefinitionInterface←OptionsBagwhich seems to be a key-value object.AttributeCreate:namesanddescriptionsareobject,optionsisn't clear.AttributeUpdate: idem.CustomerGroupCreate:namesanddescriptionsareobject.CustomerGroupUpdate:namesis an object;languagesdoesn't exist.ProductListGet:languagesis an array of strings (language codes as strings).ProductGet: idem.ProductCreate:attributesmight be an array of objects.ProductUpdate: idem.ProductVariant:DiscriminatorAttributesListis an array ofAttributeProductVariantCreate:attributesshould be an object as there is no associative array in JSON; I set it as amixed[]to fit with the description but it should be discussed.ProductVariantGenerate: idemProductVariantUpdate: idemTaxonomyEntry:namesmight not exist. There is anamesin the PHP API contract but I see none in the REST API output.TaxonomyEntryUpdateStruct(unused)Order:contextis an object.OrderItem: idem.PaymentMethodUpdateStruct:optionsmight be anobject, I leftmixed[]. Why this not calledPaymentMethodUpdateStructParser?Checklist