Skip to content

Instantly share code, notes, and snippets.

@instance-id
Created May 28, 2025 17:27
Show Gist options
  • Save instance-id/7f94d02ceed138c8f44c83159ba8127c to your computer and use it in GitHub Desktop.
Save instance-id/7f94d02ceed138c8f44c83159ba8127c to your computer and use it in GitHub Desktop.
Nifi parameter context paste behavior

How parameter contexts are handled when you paste a processor or process group in NiFi:

Where the Paste Logic Happens

  • The UI paste action starts in the frontend, notably in files like nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/service/copy-paste.service.ts and flow.effects.ts.
  • The actual merge and conflict logic for parameter contexts is handled on the backend, specifically in Java classes like ParameterContextReplacer.java and the ProcessGroupResource REST endpoint.

Parameter Context Paste Behavior (Overwrite, Merge, Ignore?)

Based on the code and documentation:

1. If the Parameter Context does NOT exist in the destination:

  • A new Parameter Context is created.

2. If the Parameter Context does exist by name in the destination:

  • The values are merged, NOT simply overwritten or ignored.
  • New parameters in the pasted content are added to the existing context.
  • Parameters that exist in both:
    • If the value is identical, nothing changes.
    • If the value is different, the existing value in the destination context is retained; the incoming value is ignored (not overwritten).
  • Sensitive parameters: If a parameter is sensitive and does not exist, it is created but left empty.
This is confirmed by both the backend code and the official user guide:

"When importing a versioned flow from Flow Registry, if NiFi has a Parameter Context with the same name, the values are merged... If a parameter existed in both the versioned flow and the NiFi instance with identical values, no changes were made. If the parameter existed in both but with different values, the value in the NiFi instance remained unchanged."
nifi-docs/src/main/asciidoc/user-guide.adoc#L2731-L2745

3. Summary Table:

Parameter Exists in Dest? Value Same? What Happens?
No N/A Added to context
Yes Yes No change
Yes No Value in destination kept

Supporting Evidence

  • Docs: See the section on "Parameters in Versioned Flows" and the merge example (user-guide.adoc#L2731-L2745).
  • Code: ParameterContextReplacer.java is responsible for the merge logic, confirming the above behavior.
  • System Tests: CopyPasteIT.java integration tests also validate that parameter contexts are created or merged, not blindly overwritten.

In summary:
When pasting, existing parameter context items are NOT completely overwritten, and existing values are preserved if there's any difference. Only new/non-existing items are added to the destination parameter context, and existing keys/values remain unless they are identical, in which case nothing changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment