mcgilman opened a new pull request, #11088:
URL: https://github.com/apache/nifi/pull/11088

   # [NIFI-15777]: Expose whether asset content is missing on 
`AssetReferenceDTO`
   
   ## Description
   
   This change extends `AssetReferenceDTO` so API clients can tell when 
referenced asset **content** is not present on disk. The REST DTO now carries a 
read-only `missingContent` flag (Java bean name; OpenAPI documents it as 
missing content). `DtoFactory` sets that flag when building asset references 
from framework `Asset` objects and when resolving connector asset references 
via `ConnectorRepository`. Unit tests cover 
`DtoFactory.createAssetReferenceDto(Asset)` for both an existing and a missing 
content file.
   
   ## What’s changed
   
   - Added `missingContent` (`Boolean`) to `AssetReferenceDTO` with 
getter/setter and `@Schema` on the getter (read-only in the API model).
   - `createAssetReferenceDto(Asset)` sets `missingContent` to 
`!asset.getFile().exists()`.
   - `createConnectorAssetReferenceDto(String)` sets `missingContent` to `true` 
when the asset is not found in the repository; when found, it uses 
`!asset.getFile().exists()`.
   - `DtoFactoryTest`: two tests asserting `missingContent` is false when the 
mocked content file exists and true when it does not.
   
   ## Key details
   
   - **Parameter / flow asset references:** Missing content is derived from 
`Asset.getFile().exists()`.
   - **Connector asset references:** If `connectorRepository.getAsset(assetId)` 
is empty, the DTO still uses the id as the display name fallback and marks 
content as missing; if the asset exists, the same file-exists check applies.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to