Commit graph

43 commits

Author SHA1 Message Date
8b2121841f
Add SPDX license headers to workflow files
Included appropriate SPDX headers to ensure clear licensing information in both CodeQL and Dependabot workflow files. This improves compliance and transparency across the repository.
2024-09-13 20:30:57 +02:00
3205321d3d
Merge pull request #11 from step-security-bot/stepsecurity_remediation_1726251982
[StepSecurity] Apply security best practices
2024-09-13 20:28:18 +02:00
StepSecurity Bot
f4d7b6b9df
[StepSecurity] Apply security best practices
Signed-off-by: StepSecurity Bot <bot@stepsecurity.io>
2024-09-13 18:26:26 +00:00
34dd908590
Merge pull request #10 from wneessen/omitted
Some checks failed
Codecov workflow / run (push) Failing after 5s
golangci-lint / lint (push) Failing after 5s
Govulncheck Security Scan / test (push) Failing after 25s
REUSE Compliance Check / test (push) Failing after 3s
Scorecard supply-chain security / Scorecard analysis (push) Failing after 1s
SonarQube / Build and analyze (push) Failing after 2s
Add omitted functionallity
2024-09-11 11:38:00 +02:00
68fe249669
Fix typo in Omitted method name
Corrected the spelling of the `Omitted` method to ensure consistency and avoid potential confusion. This change does not affect the functionality but improves code readability and accuracy.
2024-09-11 11:34:59 +02:00
754b2b90aa
Add test for omitted field
Introduce a new test, `TestVariable_Omitted`, to verify the behavior of the `NilBoolean` type fields, ensuring the correct handling of omitted and non-omitted fields during JSON unmarshalling.
2024-09-11 11:34:44 +02:00
7f2cf28053
Moved NewVariable to top
Moved NewVariable above the receiver methods
2024-09-11 11:26:58 +02:00
270111e53f
Reorder type declarations and JSON marshal/unmarshal methods
Moved type declarations for Nil* variables to the top for better readability and organization. JSON marshal and unmarshal methods have been repositioned towards the bottom of the file to keep related logic together.
2024-09-11 11:25:37 +02:00
61e2f10196
Refactor Variable type and add omitted status
Reorganized methods to ensure a logical method order and added the `present` field to track omitted values in JSON. This improves clarity and functionality by correctly indicating when a value was omitted.
2024-09-11 11:23:33 +02:00
ab766b23fa
Merge pull request #9 from wneessen/update-readme
Fix typo and improve readability in README.md
2024-09-11 11:08:30 +02:00
bc611894a8
Fix typo and improve readability in README.md
Corrected misspelling of 'niljson' and clarified punctuation. These changes enhance the clarity of sentences, ensuring better readability and comprehension for users.
2024-09-11 11:08:03 +02:00
7bddca99ae
Merge pull request #8 from wneessen/more-cleanup-cleanup
More code cleanup and security workflows
2024-09-11 11:00:07 +02:00
10d77340d5
Add security workflows for code analysis
This commit introduces three GitHub Actions workflows: `govulncheck`, `dependency-review`, and `scorecards`. These workflows enhance security by scanning for vulnerabilities, reviewing dependencies, and analyzing the supply-chain, respectively.
2024-09-11 10:58:53 +02:00
50877176f5
Simplify error reporting in niljson tests
Replaced t.Errorf with t.Error in niljson test cases for more concise error reporting. This change improves readability and maintains consistency across tests by using the simpler t.Error method.
2024-09-11 10:55:36 +02:00
d427f46eda
Merge pull request #7 from wneessen/more-cleanup
Refactor error messages in niljson tests.
2024-09-11 10:43:55 +02:00
0922c9d322
Refactor error messages in niljson tests.
Replaced hard-coded error strings with constant variables to improve code maintenance and readability. This ensures consistency across error messages and makes future updates easier.
2024-09-11 10:43:31 +02:00
c602cb5a96
Merge pull request #6 from wneessen/code-cleanup
Code cleanup
2024-09-11 10:32:10 +02:00
9584d3ec3c
Refactor error messages in niljson_test.go
Replaced hardcoded error strings with `ErrExpectedJSONInt` constant for consistency. This improves maintainability and readability of the test code by centralizing error message definitions.
2024-09-11 10:31:42 +02:00
98bcb37c50
Refactor error messages to use constants in tests
Added a new constant ErrExpectedJSONString for uniformity in error messages. Updated all relevant test cases to utilize this new constant instead of hardcoding the error message, enhancing code maintainability and readability.
2024-09-11 10:30:02 +02:00
296050ca70
Define error constants for JSON marshaling/unmarshaling tests
Introduced `ErrUnmarshalFailed` and `ErrMarshalFailed` constants to standardize error messages in JSON tests. This enhances code readability and maintainability by avoiding repeated strings directly in the test cases.
2024-09-11 10:27:55 +02:00
44cc717bc3
Merge pull request #5 from wneessen/fix-sonarqube
Fix Go version syntax in SonarQube workflow
2024-09-11 10:23:09 +02:00
926cfc9581
Fix Go version syntax in SonarQube workflow
Corrected the Go version syntax from '1.23.x' to '1.23' in the SonarQube GitHub Action workflow configuration to ensure proper version setup. This change addresses potential issues with version resolution in the setup-go action.
2024-09-11 10:22:51 +02:00
31d2bea9c6
Merge pull request #4 from wneessen/sonarqube-action
Add SonarQube integration for code analysis
2024-09-11 10:20:55 +02:00
e557e4caac
Add SonarQube integration for code analysis
Introduce a new SonarQube configuration to the project. This includes a GitHub action workflow for continuous integration on the main branch, setting up Go environment, running unit tests, and performing SonarQube analysis. This addition aims to ensure code quality and coverage are continuously monitored.
2024-09-11 10:19:00 +02:00
02d6e1f130
Merge pull request #3 from wneessen/marshalling
Some checks failed
Codecov workflow / run (push) Failing after 4s
golangci-lint / lint (push) Failing after 4s
REUSE Compliance Check / test (push) Failing after 3s
Add JSON marshaling support for Variable types
2024-09-02 12:19:23 +02:00
dee653ae88
Update README to include marshalling capability
Expanded the description and features to cover both marshalling and unmarshalling of JSON fields. This clarifies the package's functionality, making it clear that it handles not only null values during unmarshalling but also during marshalling.
2024-09-02 12:15:38 +02:00
05d806adff
Add JSON marshaling support for Variable types
Introduced a NewVariable function for creating generics-based Variable types. Added MarshalJSON methods to support JSON encoding for various Nil types, ensuring proper handling of nil values. Updated tests and examples to verify the new marshaling functionality.
2024-09-02 12:13:54 +02:00
25913bbf9f
Merge pull request #2 from wneessen/remove-redundant-get
Some checks failed
Codecov workflow / run (push) Failing after 3s
golangci-lint / lint (push) Failing after 3s
REUSE Compliance Check / test (push) Failing after 2s
Remove redundant Get() method
2024-09-01 21:17:50 +02:00
1150734ab0
Remove redundant Get() method
The Get() method was simply an alias for the Value() method and did not add any functionality. This simplification makes the code cleaner and reduces unnecessary duplication, improving maintainability.
2024-09-01 21:14:46 +02:00
b11f8257d8
Merge pull request #1 from wneessen/add_uint_tpes
Add uint types
2024-09-01 19:52:07 +02:00
89d0a3f00e
Add comprehensive nil type JSON unmarshal tests
This commit restructures and extends the JSON unmarshal tests for nil types to cover more data types, including boolean, byte slice, float32, float64, int, int64, string, and various unsigned integers. Each test ensures proper handling of value retrieval, nil checks, and reset behavior, enhancing the robustness of the unmarshal functionality.
2024-09-01 19:48:57 +02:00
63c28cbb9e
Add nullable unsigned integer types
Introduced new types: NilUInt, NilUInt8, NilUInt16, NilUInt32, and NilUInt64 to support nullable unsigned integers. This enhancement aligns with existing nullable types for better consistency and flexibility.
2024-09-01 19:24:45 +02:00
65168ce50b
Downgrade Go version to 1.18
This change updates the Go version in go.mod from 1.23 to 1.18. It ensures compatibility with the current development environment and resolves any version-specific issues.```
2024-09-01 19:23:55 +02:00
bdd7efec82
Refactor data processing and message formatting
Updated the JSON data structure for better readability and added more comprehensive output formatting in the main function. Utilized a single 'output' string to accumulate messages, improving code readability and efficiency.
2024-09-01 17:05:11 +02:00
ab747282c8
Add example for Nil value JSON unmarshaling
Introduced ExampleVariable_UnmarshalJSON to demonstrate unmarshaling of JSON with nil and non-nil fields. This includes handling for multiple custom types and provides a sample output. Added necessary imports and error handling for clarity.
2024-09-01 17:04:55 +02:00
80f2ea15a5
Add additional nil checks in niljson_test.go
Enhanced the test coverage by adding nil checks for ByteSlice and Float32 types after reset. This ensures that more types are adequately handled and validated for nil values in the tests. Additionally, included a check for the string using the Get method.
2024-09-01 16:51:10 +02:00
fcc4f5d0d0
Add CC0-1.0 and MIT license files
Introduced CC0-1.0 and MIT license texts to the project for clear legal guidelines and attribution. These additions help clarify usage rights and responsibilities for contributors and users of the software.
2024-09-01 16:49:27 +02:00
34fae8a109
Fix indentation issue in README.md
Corrected the indentation of the Float32 field in the JSONType struct. This change improves code readability and maintains consistent formatting throughout the documentation.
2024-09-01 16:49:08 +02:00
d6b359f1f5
Fix login method to avoid null pointer exceptions
This update adds null checks before accessing user credentials during the login process. It ensures the application does not crash when trying to authenticate with incomplete data.
2024-09-01 16:47:26 +02:00
d558f5dffb
Add detailed README documentation with examples.
Expand the README to include license information, badges, and detailed documentation. Also provide example usage of the `niljson` package to help users understand how to integrate and use nullable JSON fields in their Go applications.
2024-09-01 16:46:02 +02:00
4224968915
Add support for additional types in niljson
Enhanced the niljson package to include support for byte slices and float32 types. Updated the test cases to validate these new types and modified method names to be more consistent.
2024-09-01 16:41:53 +02:00
03f6fd14d1
Initial checkin 2024-09-01 16:01:58 +02:00
f3a9441638
Initial commit 2024-09-01 15:53:52 +02:00