SAP / cloud-sdk

The SAP Cloud SDK documentation and support repository.
https://sap.github.io/cloud-sdk/
Apache License 2.0
44 stars 41 forks source link

Making Cloud SDK correctly percent-encode space as %20 #864

Closed tejasvgupta9 closed 2 years ago

tejasvgupta9 commented 2 years ago

Issue Description

I need to build a Mock Service using CAP which will mimic the behaviour of Odata Service V2 ( Gateway Service). After building the CAP Service I have observed the following difference in behaviour: Observation:

  1. Gateway Odata Supports the following OrderBy clause: $orderby=GLAccount+asc,CompanyCode+asc
  2. CAP Odata V2 does not support the following OrderBy clause: $orderby=GLAccount+asc,CompanyCode+asc But supports the following one without the ‘+’ character: $orderby=GLAccount asc,CompanyCode asc

In one of our use cases we are using Cloud SDK to form the Odata query which is produces the Order By Clause with ‘+’ character.

I need your help regarding the following queries: Since our usecase requires consumption of a CAP Service using Cloud SDK, We want Cloud SDK to correctly percent-encode space as %20

We also consulted the Odata team to understand the correct behavior and as per their reply:

OData clients MUST encode space as %20 and MUST NOT rely on some non-standard feature of some OData server implementation.

This is a blocker for us and we need your help to unblock us.

Maven Dependency Tree

s4-mock-service:s4-mock-service:jar:1.0.0-SNAPSHOT
[INFO] +- com.sap.cds:cds-starter-spring-boot:jar:1.25.0-m2220:compile
[INFO] |  +- com.sap.cds:cds-services-api:jar:1.25.0-m2220:compile
[INFO] |  |  \- com.sap.cds:cds4j-api:jar:1.28.0-m20220426-182027:compile
[INFO] |  +- com.sap.cds:cds-services-impl:jar:1.25.0-m2220:runtime
[INFO] |  +- com.sap.cds:cds-feature-jdbc:jar:1.25.0-m2220:runtime
[INFO] |  |  +- com.sap.cds:cds4j-runtime:jar:1.28.0-m20220426-182027:runtime
[INFO] |  |  |  \- com.sap.cds:cds4j-jdbc-spi:jar:1.28.0-m20220426-182027:runtime
[INFO] |  |  \- com.sap.cds:cds4j-tx:jar:1.28.0-m20220426-182027:runtime
[INFO] |  +- com.sap.cds:cds-framework-spring-boot:jar:1.25.0-m2220:runtime
[INFO] |  |  \- org.springframework.boot:spring-boot-starter:jar:2.6.7:compile
[INFO] |  |     +- org.springframework.boot:spring-boot:jar:2.6.7:compile
[INFO] |  |     +- org.springframework.boot:spring-boot-autoconfigure:jar:2.6.7:compile
[INFO] |  |     +- org.springframework.boot:spring-boot-starter-logging:jar:2.6.7:compile
[INFO] |  |     |  +- ch.qos.logback:logback-classic:jar:1.2.11:compile
[INFO] |  |     |  |  \- ch.qos.logback:logback-core:jar:1.2.11:compile
[INFO] |  |     |  \- org.slf4j:jul-to-slf4j:jar:1.7.36:compile
[INFO] |  |     +- jakarta.annotation:jakarta.annotation-api:jar:1.3.5:compile
[INFO] |  |     +- org.springframework:spring-core:jar:5.3.19:compile
[INFO] |  |     |  \- org.springframework:spring-jcl:jar:5.3.19:compile
[INFO] |  |     \- org.yaml:snakeyaml:jar:1.29:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-web:jar:2.6.7:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-starter-json:jar:2.6.7:compile
[INFO] |  |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.13.2:compile
[INFO] |  |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.13.2:compile
[INFO] |  |  |  \- com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.13.2:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-starter-tomcat:jar:2.6.7:compile
[INFO] |  |  |  +- org.apache.tomcat.embed:tomcat-embed-core:jar:9.0.62:compile
[INFO] |  |  |  +- org.apache.tomcat.embed:tomcat-embed-el:jar:9.0.62:compile
[INFO] |  |  |  \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:9.0.62:compile
[INFO] |  |  +- org.springframework:spring-web:jar:5.3.19:compile
[INFO] |  |  |  \- org.springframework:spring-beans:jar:5.3.19:compile
[INFO] |  |  \- org.springframework:spring-webmvc:jar:5.3.19:compile
[INFO] |  |     +- org.springframework:spring-aop:jar:5.3.19:compile
[INFO] |  |     +- org.springframework:spring-context:jar:5.3.19:compile
[INFO] |  |     \- org.springframework:spring-expression:jar:5.3.19:compile
[INFO] |  \- org.springframework.boot:spring-boot-starter-jdbc:jar:2.6.7:compile
[INFO] |     +- com.zaxxer:HikariCP:jar:4.0.3:compile
[INFO] |     \- org.springframework:spring-jdbc:jar:5.3.19:compile
[INFO] |        \- org.springframework:spring-tx:jar:5.3.19:compile
[INFO] +- com.sap.cds:cds-adapter-odata-v2:jar:1.25.0-m2220:runtime
[INFO] |  +- com.sap.cds:cds-adapter-api:jar:1.25.0-m2220:compile
[INFO] |  +- com.sap.cds:cds-services-utils:jar:1.25.0-m2220:compile
[INFO] |  |  +- javax.jms:javax.jms-api:jar:2.0.1:compile
[INFO] |  |  +- org.apache.httpcomponents:httpclient:jar:4.5.13:compile
[INFO] |  |  |  \- org.apache.httpcomponents:httpcore:jar:4.4.15:compile
[INFO] |  |  \- commons-codec:commons-codec:jar:1.15:compile
[INFO] |  +- com.sap.cds:cds4j-core:jar:1.28.0-m20220426-182027:runtime
[INFO] |  |  +- com.google.guava:guava:jar:30.1-jre:compile
[INFO] |  |  |  +- com.google.guava:failureaccess:jar:1.0.1:compile
[INFO] |  |  |  +- com.google.guava:listenablefuture:jar:9999.0-empty-to-avoid-conflict-with-guava:compile
[INFO] |  |  |  +- com.google.code.findbugs:jsr305:jar:3.0.2:compile
[INFO] |  |  |  +- org.checkerframework:checker-qual:jar:3.5.0:compile
[INFO] |  |  |  +- com.google.errorprone:error_prone_annotations:jar:2.3.4:compile
[INFO] |  |  |  \- com.google.j2objc:j2objc-annotations:jar:1.3:compile
[INFO] |  |  \- com.fasterxml.jackson.core:jackson-databind:jar:2.13.2.1:compile
[INFO] |  |     +- com.fasterxml.jackson.core:jackson-annotations:jar:2.13.2:compile
[INFO] |  |     \- com.fasterxml.jackson.core:jackson-core:jar:2.13.2:compile
[INFO] |  +- com.sap.cloud.mt:cds-mtx:jar:1.15.0-m20220426-125110:compile
[INFO] |  |  +- com.sap.cloud.security.xsuaa:token-client:jar:2.11.16:compile
[INFO] |  |  |  +- com.sap.cloud.security.xsuaa:api:jar:2.11.16:compile
[INFO] |  |  |  +- com.sap.cloud.security:java-api:jar:2.11.16:compile
[INFO] |  |  |  +- org.json:json:jar:20220320:compile
[INFO] |  |  |  \- com.github.ben-manes.caffeine:caffeine:jar:2.9.3:compile
[INFO] |  |  +- commons-io:commons-io:jar:2.11.0:compile
[INFO] |  |  +- com.sap.cloud.sdk.cloudplatform:cloudplatform-connectivity:jar:3.67.0:compile
[INFO] |  |  |  +- com.sap.cloud.sdk.cloudplatform:cloudplatform-core:jar:3.67.0:compile
[INFO] |  |  |  +- com.sap.cloud.sdk.cloudplatform:caching:jar:3.67.0:compile
[INFO] |  |  |  +- com.sap.cloud.sdk.cloudplatform:security:jar:3.67.0:compile
[INFO] |  |  |  +- com.sap.cloud.sdk.cloudplatform:tenant:jar:3.67.0:compile
[INFO] |  |  |  +- com.sap.cloud.sdk.cloudplatform:servlet:jar:3.67.0:compile
[INFO] |  |  |  +- com.sap.cloud.sdk.quality:common:jar:3.67.0:compile
[INFO] |  |  |  |  \- org.apache.commons:commons-csv:jar:1.9.0:compile
[INFO] |  |  |  +- org.slf4j:jcl-over-slf4j:jar:1.7.36:runtime
[INFO] |  |  |  +- io.vavr:vavr:jar:0.10.4:compile
[INFO] |  |  |  |  \- io.vavr:vavr-match:jar:0.10.4:compile
[INFO] |  |  |  \- com.mikesamuel:json-sanitizer:jar:1.2.3:compile
[INFO] |  |  \- com.sap.cloud.mt:tools:jar:1.15.0-m20220426-125110:compile
[INFO] |  |     \- com.sap.cloud.security:env:jar:2.11.16:compile
[INFO] |  +- com.sap.cds.repackaged:odata-v2-lib:jar:1.25.0-m2220:runtime
[INFO] |  |  +- javax.ws.rs:javax.ws.rs-api:jar:2.1-m09:runtime
[INFO] |  |  \- com.google.code.gson:gson:jar:2.8.9:compile
[INFO] |  +- org.slf4j:slf4j-api:jar:1.7.36:compile
[INFO] |  \- org.apache.commons:commons-lang3:jar:3.12.0:compile
[INFO] +- com.h2database:h2:jar:1.4.200:runtime
[INFO] +- junit:junit:jar:4.13.2:test
[INFO] |  \- org.hamcrest:hamcrest-core:jar:2.2:test
[INFO] |     \- org.hamcrest:hamcrest:jar:2.2:test
[INFO] \- com.sap.cds:cds-starter-cloudfoundry:jar:1.25.0-m2220:compile
[INFO]    +- com.sap.cds:cds-feature-hana:jar:1.25.0-m2220:compile
[INFO]    |  \- com.sap.cloud.db.jdbc:ngdbc:jar:2.12.9:compile
[INFO]    +- com.sap.cds:cds-feature-mt:jar:1.25.0-m2220:compile
[INFO]    |  +- com.sap.cloud.mt:multi-tenant-runtime:jar:1.15.0-m20220426-125110:compile
[INFO]    |  +- com.sap.cloud.mt:multi-tenant-subscription:jar:1.15.0-m20220426-125110:compile
[INFO]    |  |  \- com.sap.cloud.instancemanager:client:jar:2.0.7:compile
[INFO]    |  |     +- com.sap.cloud.security:java-security:jar:2.11.3:compile
[INFO]    |  |     +- com.sap.cloud.instancemanager:util:jar:2.0.7:compile
[INFO]    |  |     \- com.sap.cloud.instancemanager:client-api:jar:2.0.7:compile
[INFO]    |  \- com.sap.cds:cds-integration-cloud-sdk:jar:1.25.0-m2220:runtime
[INFO]    |     \- com.sap.cloud.sdk.frameworks:resilience4j:jar:3.67.0:runtime
[INFO]    |        +- com.sap.cloud.sdk.cloudplatform:resilience:jar:3.67.0:runtime
[INFO]    |        +- io.github.resilience4j:resilience4j-circuitbreaker:jar:1.7.1:runtime
[INFO]    |        |  \- io.github.resilience4j:resilience4j-core:jar:1.7.1:runtime
[INFO]    |        +- io.github.resilience4j:resilience4j-bulkhead:jar:1.7.1:runtime
[INFO]    |        +- io.github.resilience4j:resilience4j-timelimiter:jar:1.7.1:runtime
[INFO]    |        +- io.github.resilience4j:resilience4j-cache:jar:1.7.1:runtime
[INFO]    |        |  \- javax.cache:cache-api:jar:1.1.1:runtime
[INFO]    |        +- io.github.resilience4j:resilience4j-retry:jar:1.7.1:runtime
[INFO]    |        \- io.github.resilience4j:resilience4j-ratelimiter:jar:1.7.1:runtime
[INFO]    +- com.sap.cds:cds-feature-cloudfoundry:jar:1.25.0-m2220:compile
[INFO]    +- com.sap.cds:cds-feature-xsuaa:jar:1.25.0-m2220:compile
[INFO]    \- com.sap.cloud.security.xsuaa:xsuaa-spring-boot-starter:jar:2.11.16:compile
[INFO]       +- com.sap.cloud.security.xsuaa:spring-xsuaa:jar:2.11.16:compile
[INFO]       |  \- org.apache.logging.log4j:log4j-to-slf4j:jar:2.17.2:compile
[INFO]       |     \- org.apache.logging.log4j:log4j-api:jar:2.17.2:compile
[INFO]       +- org.springframework.boot:spring-boot-starter-security:jar:2.6.7:compile
[INFO]       |  +- org.springframework.security:spring-security-config:jar:5.6.3:compile
[INFO]       |  \- org.springframework.security:spring-security-web:jar:5.6.3:compile
[INFO]       +- org.springframework.security:spring-security-oauth2-jose:jar:5.6.3:compile
[INFO]       |  +- org.springframework.security:spring-security-core:jar:5.6.3:compile
[INFO]       |  |  \- org.springframework.security:spring-security-crypto:jar:5.6.3:compile
[INFO]       |  +- org.springframework.security:spring-security-oauth2-core:jar:5.6.3:compile
[INFO]       |  \- com.nimbusds:nimbus-jose-jwt:jar:9.14:compile
[INFO]       |     \- com.github.stephenc.jcip:jcip-annotations:jar:1.0-1:compile
[INFO]       \- org.springframework.security:spring-security-oauth2-resource-server:jar:5.6.3:compile

Project Details


Checklist

newtork commented 2 years ago

Hi @tejasvgupta9,

I couldn't reproduce the issue, all my checks resulted in %20, no +. Can you share the code with which you construct and invoke the failing OData query?

Kind regards Alexander

Johannes-Schneider commented 2 years ago

I'm closing this issue due to inactivity.

Please feel free to either reopen this ticket or to create a new one in case you encounter further questions/problems.