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

interface SiteDefinitionLanguage Url and UrlSegment wrong casing #38

Open
mathmoth opened this issue Oct 19, 2024 · 2 comments
Open

interface SiteDefinitionLanguage Url and UrlSegment wrong casing #38

mathmoth opened this issue Oct 19, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@mathmoth
Copy link

I noticed a discrepancy between how the interface SiteDefinitionLanguage defines Url and UrlSegment and what is returned from the Content Delivery API. In the API response these members are called url and urlSegment. Trying to access Url will always result in undefined.

@JohanPetersson
Copy link
Contributor

Camel case is commonly used in JavaScript, that's why properties start with lowercase. JavaScript (JSON) is case-sensitive, and that's why you're getting undefined, i.e. there is no property called Url. This is the case for all objects returned by the REST API, at least for all built-in properties, the exception is your custom properties which will have the casing you have defined them with.

@mathmoth
Copy link
Author

Hi Johan, I think perhaps you misunderstood my issue, I'll try to clarify:

I was referring to the interface SiteDefinitionLanguage in the content-delivery-sdk, this one right here:
https://github.com/episerver/content-delivery-js-sdk/blob/master/src/%40episerver/content-delivery/src/models.mts

image

This typescript interface has Url and UrlSegment with starting uppecase, whilst the API will return the data with starting lowercase:
image

So using the API and using the SDK's own typings you will get a mismatch on these properties, I was not referring to any custom properties.

@JohanPetersson JohanPetersson added the bug Something isn't working label Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants