Utilities resource (status, headers, user) + §6.4 exception rename#3
Closed
MarketDataDev03 wants to merge 5 commits into
Closed
Utilities resource (status, headers, user) + §6.4 exception rename#3MarketDataDev03 wants to merge 5 commits into
MarketDataDev03 wants to merge 5 commits into
Conversation
|
The author of this PR, MarketDataDev03, is not an activated member of this organization on Codecov. |
d617db2 to
63fc0a6
Compare
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
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.
feat: Utilities resource (status, headers, user) + §6.4 exception rename
Adds the second endpoint group:
utilitieswith all three methods named in SDK requirements §1.2 / §2.2 —status,headers,user. Reuses the HTTP transport + wire-format pattern landed by the markets PR; introduces the small extensions needed to handle endpoints that live outside/v1/. Also wiresvalidateOnStartupto actually call/user/, and aligns the exception subtype names with §6.4's Java idiom.What's included
com.marketdata.sdk.utilities— the new resourceclient.utilities().status()GET /status/client.utilities().headers()GET /headers/client.utilities().user()GET /user/@JsonPropertykeysAll three live at the API root, not under
/v1/(a backend quirk: the user/status/headers viewsets are mounted on the admin router which binds to root). New domain types:UserInfo,ServiceStatus,ServiceHealth,RequestHeaders. Two new wire-format adapters —ServiceStatusDeserializer(parallel-arrays, mirrors the markets pattern) andRequestHeadersDeserializer(collapses arbitrary keys into a case-insensitiveMap).RequestSpec.getAtRoot(...)— small extension to the transport contractRequestSpecgained a second factory next toget(...): paths built viagetAtRoot(...)skip the/v1/version prefix.HttpTransport.buildUrinow reads the newversionedflag on the spec to decide. Default behavior unchanged for every endpoint that landed in 01 — only utilities uses the root path today.validateOnStartupactually does something nowThe flag existed in 01 as a seam. This PR wires it to call
client.utilities().user()from theMarketDataClientconstructor when enabled (defaulttrue) and a token is present — failing fast withAuthenticationExceptionfrom the constructor if the token is invalid. The same call also seeds the rate-limit snapshot at boot per SDK requirements §8.1.Exception subtype rename per §6.4
The 7 sealed subtypes of
MarketDataExceptionwent from*Error(literal §6.1 names) to*Exception(Java idiom mandated by §6.4). The base class was alreadyMarketDataException; this aligns the leaves with it.Errorin Java has a specific JVM meaning ("don't catch this") that conflicted with ourRuntimeExceptionsubtypes — the rename removes that signal mismatch.Renamed:
AuthenticationError → AuthenticationException,BadRequestError → BadRequestException,NotFoundError → NotFoundException,RateLimitError → RateLimitException,ServerError → ServerException,NetworkError → NetworkException,ParseError → ParseException.getSupportInfo()output'sType:line now readsRateLimitExceptioninstead ofRateLimitError, which is what §6.4's Java example shows.FAIL_ON_UNKNOWN_PROPERTIES = falseThe shared
ObjectMapperinHttpTransportis now configured to ignore unknown JSON properties. Found empirically when integration-testing/user/: the API returns thesstatus field on most endpoints, including ones whose canonical schema doesn't list it. Defaulting Jackson to lenient is the canonical posture for a long-lived SDK — when the API adds a new response field, existing consumers don't break. The custom deserializers (parallel-arrays decoders) handle their own validation explicitly anyway.Tests
ServiceStatusDeserializerTests, allOnline logic)RequestHeadersDeserializerTestUtilitiesResourceTestResource → Transport → in-process HttpServerpath, parameterized over sync/async for the load-bearing scenariosMarketDataClientStartupValidationTestvalidateOnStartupctor behavior — 401 fails the build, demo mode skips, opt-out skips, success populates the rate-limit snapshotMarketDataExceptionTestsupportInfoRendersNAForMissingFieldsbrings the package's branch coverage to 100 %UtilitiesUserIT,UtilitiesStatusIT,UtilitiesHeadersITExisting tests (
MarketsResourceTest,MarketDataClientTest, etc.) updated mechanically for the exception rename and to be robust against the presence ofMARKETDATA_TOKENin.env(relevant once the consumer-test app or local dev configures one).Coverage at the merge gate
Codecov 5 pp ratchet vs base branch is satisfied (no regression).