global fields implementation and testcases#59
Merged
harshithad0703 merged 4 commits intodevelopmentfrom Jun 12, 2025
Merged
Conversation
- Implemented GlobalField.h and GlobalField.m to define the GlobalField interface and its methods. - Updated Stack.h and Stack.m to include methods for creating GlobalField instances. - Added API URL methods in CSIOAPIURLs.h and CSIOAPIURLs.m for fetching global fields. - Introduced constants in CSIOConstants.h and CSIOConstants.m for global field properties. - Updated internal headers to include GlobalField.
There was a problem hiding this comment.
Pull Request Overview
This PR introduces the GlobalField resource into the SDK, wiring up model, API endpoints, and test coverage.
- Adds
GlobalFieldclass with fetch and fetchAll methods and inclusion options. - Updates
Stackto expose globalField initializers and extends internal headers, constants, and URL builders. - Provides unit tests for successful fetches, error handling, and include parameters; cleans up existing debug logs.
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| Contentstack/GlobalField.h | Declares GlobalField interface and public methods |
| Contentstack/GlobalField.m | Implements GlobalField logic, networking, and parsing |
| Contentstack/Stack.h, Contentstack/Stack.m | Exposes globalField and globalFieldWithName: on Stack |
| ContentstackInternal/CSIOInternalHeaders.h | Adds private GlobalField initializers |
| ContentstackInternal/CSIOConstants.h, .m | Introduces JSON key constants for global fields |
| ContentstackInternal/CSIOAPIURLs.h, .m | Adds URL generation for single and multiple global fields |
| ContentstackTest/GlobalFieldTest.m | Adds unit tests covering fetch, fetchAll, and include options |
| ContentstackTest/ContentstackTest.m | Comments out old NSLog debug statements |
| Contentstack.xcodeproj/project.pbxproj | Registers new source and test files in project |
Comments suppressed due to low confidence (7)
Contentstack/GlobalField.h:39
- Property 'Description' starts with an uppercase letter and conflicts with NSObject's -description; consider renaming (e.g., 'fieldDescription') to avoid collision and follow naming conventions.
@property (nonatomic, copy, readonly) NSString *Description;
Contentstack/GlobalField.h:167
- The doc comment describes fetching an asset rather than a global field; update the description to accurately reflect the GlobalField fetch method.
* Fetches an asset asynchronously provided asset UID
ContentstackInternal/CSIOConstants.m:141
- [nitpick] Constant name 'kCSIO_globalfield' is lowercase and does not match the camelCase pattern used elsewhere; consider renaming to 'kCSIO_GlobalField' or matching the existing style.
NSString *const kCSIO_globalfield = @"global_field";
ContentstackInternal/CSIOAPIURLs.m:86
- The method is declared with '++' instead of '+' which will cause a syntax error. Change '++' to '+'.
++(NSString*)fetchGlobalFieldWithVersion:(NSString*)globalFieldUID withVersion:(NSString*)version {
ContentstackInternal/CSIOAPIURLs.m:90
- The method is declared with '++' instead of '+' which will cause a syntax error. Change '++' to '+'.
++(NSString*)findGlobalFieldsWithVersion:(NSString*)version {
ContentstackInternal/CSIOAPIURLs.h:38
- The declaration has an extra '+' prefix ('++') which will fail to compile. Remove the extra '+'.
++(NSString*)fetchGlobalFieldWithVersion:(NSString*) globalFieldUID withVersion:(NSString*)version;
ContentstackInternal/CSIOAPIURLs.h:40
- The declaration has an extra '+' prefix ('++') which will fail to compile. Remove the extra '+'.
++(NSString*)findGlobalFieldsWithVersion:(NSString*)version;
vkalta
previously approved these changes
Jun 6, 2025
harshithad0703
approved these changes
Jun 12, 2025
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.
No description provided.