opencti icon indicating copy to clipboard operation
opencti copied to clipboard

[Being Decomposed into Multiple PRs] Add required fields flagging to majority of platform object types w/ some caveats

Open ParamConstructor opened this issue 1 year ago • 2 comments

Proposed changes

Modify system to support dynamic required fields using the existing capability per object type off the Admin console. These fields that are required will be marked with a "*" Stars shown next to labels and result in a read error call out when not filled in/provided.

This change is implemented across the platform where currently supported on existing objects. The Related Issues section will cover where the change was not implemented and why. On those areas, the platform behavior for required field remains unchanged.

Related issues

  • All files requiring change have been determined by a search of the codebase for 'This field is required' and by limiting found files to ./*/.tsx. The exceptions are listed in these comments.

  • There are roughly 46 *.jsx files that need to be rewritten as *.tsx. That is considered outside tech debt and can be performed, as need, adopting this required fields implementation at that time.

  • External-Reference is not directly supported for this required fields change. Based on communication with the Filigran team - this field will require many complex relationships between mandatory attributes to fully implement

  • ScaleConfiguration, StixCoreObjectFileExport - Do not currently store attribute configuration in GraphQL, so unable to manage required fields via useSchemaAttributes or useEntitySettings for these fields. [Tech Debt]

  • NotifierCreation and NotifierEdition - FORMIK errors were not reported back to user on these objects, unclear how to fix this issue, so not implemented on these objects.

  • CsvMapperForm appears to be a work in progress - this change has skipped that form for now.

  • SettingsMessages data objects need to be registered as InternalObjects within the opencti-platform/opencti-graphql/src/modules/attributes/internalObject-registrationAttributes.ts source. This is necessary for the useMandatorySchemaAttributes capability to work, so this has been skipped. [Tech Debt]

Checklist

  • [X] I consider the submitted work as finished
  • [X] I tested the code for its functionality
  • [ ] I wrote test cases for the relevant uses case
  • [ ] I added/update the relevant documentation (either on github or on notion)
  • [X] Where necessary I refactored code to improve the overall quality

Further comments

N/A

ParamConstructor avatar Feb 09 '24 13:02 ParamConstructor

Codecov Report

Attention: Patch coverage is 40.12739% with 94 lines in your changes are missing coverage. Please review.

Project coverage is 66.67%. Comparing base (cff70c3) to head (6c8dd6e).

:exclamation: Current head 6c8dd6e differs from pull request most recent head a0b7c85. Consider uploading reports for the commit a0b7c85 to get more accurate results

Files Patch % Lines
...rm/opencti-graphql/src/domain/attribute-details.ts 23.57% 94 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5877      +/-   ##
==========================================
- Coverage   67.76%   66.67%   -1.10%     
==========================================
  Files         532      542      +10     
  Lines       65069    64693     -376     
  Branches     5464     5306     -158     
==========================================
- Hits        44097    43135     -962     
- Misses      20972    21558     +586     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Feb 09 '24 18:02 codecov[bot]

Decomposed into a smaller initial PR of 65 files - https://github.com/OpenCTI-Platform/opencti/pull/6972. After merge of that - will rebase this and it will contain the remaining changes to complete this capability.

ParamConstructor avatar May 15 '24 16:05 ParamConstructor