Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a CLI command to list Metapath functions #39

Conversation

david-waltermire
Copy link
Contributor

@david-waltermire david-waltermire commented May 27, 2024

Committer Notes

This adds a new CLI command metaschema-cli metapath list-functions that lists all supported functions and their signature.

Example output:

In namespace 'http://csrc.nist.gov/ns/metaschema':
Q{http://csrc.nist.gov/ns/metaschema}model(node as gov.nist.secauto.metaschema.core.metapath.item.node.INodeItem) as gov.nist.secauto.metaschema.core.metapath.item.node.INodeItem?
In namespace 'http://csrc.nist.gov/ns/metaschema/metapath':
Q{http://csrc.nist.gov/ns/metaschema/metapath}boolean(arg1 as gov.nist.secauto.metaschema.core.metapath.item.atomic.IAnyAtomicItem?) as gov.nist.secauto.metaschema.core.metapath.item.atomic.IBooleanItem?
Q{http://csrc.nist.gov/ns/metaschema/metapath}date(arg1 as gov.nist.secauto.metaschema.core.metapath.item.atomic.IAnyAtomicItem?) as gov.nist.secauto.metaschema.core.metapath.item.atomic.IDateItem?
Q{http://csrc.nist.gov/ns/metaschema/metapath}date-time(arg1 as gov.nist.secauto.metaschema.core.metapath.item.atomic.IAnyAtomicItem?) as gov.nist.secauto.metaschema.core.metapath.item.atomic.IDateTimeItem?
Q{http://csrc.nist.gov/ns/metaschema/metapath}decimal(arg1 as gov.nist.secauto.metaschema.core.metapath.item.atomic.IAnyAtomicItem?) as gov.nist.secauto.metaschema.core.metapath.item.atomic.IDecimalItem?
Q{http://csrc.nist.gov/ns/metaschema/metapath}duration(arg1 as gov.nist.secauto.metaschema.core.metapath.item.atomic.IAnyAtomicItem?) as gov.nist.secauto.metaschema.core.metapath.item.atomic.IDurationItem?
Q{http://csrc.nist.gov/ns/metaschema/metapath}integer(arg1 as gov.nist.secauto.metaschema.core.metapath.item.atomic.IAnyAtomicItem?) as gov.nist.secauto.metaschema.core.metapath.item.atomic.IIntegerItem?
Q{http://csrc.nist.gov/ns/metaschema/metapath}ncname(arg1 as gov.nist.secauto.metaschema.core.metapath.item.atomic.IAnyAtomicItem?) as gov.nist.secauto.metaschema.core.metapath.item.atomic.INcNameItem?
Q{http://csrc.nist.gov/ns/metaschema/metapath}non-negative-integer(arg1 as gov.nist.secauto.metaschema.core.metapath.item.atomic.IAnyAtomicItem?) as gov.nist.secauto.metaschema.core.metapath.item.atomic.INonNegativeIntegerItem?
Q{http://csrc.nist.gov/ns/metaschema/metapath}positive-integer(arg1 as gov.nist.secauto.metaschema.core.metapath.item.atomic.IAnyAtomicItem?) as gov.nist.secauto.metaschema.core.metapath.item.atomic.IPositiveIntegerItem?
Q{http://csrc.nist.gov/ns/metaschema/metapath}recurse-depth(recursePath as gov.nist.secauto.metaschema.core.metapath.item.atomic.IStringItem) as gov.nist.secauto.metaschema.core.metapath.item.node.INodeItem*
Q{http://csrc.nist.gov/ns/metaschema/metapath}recurse-depth(context as gov.nist.secauto.metaschema.core.metapath.item.node.INodeItem*,recursePath as gov.nist.secauto.metaschema.core.metapath.item.atomic.IStringItem) as gov.nist.secauto.metaschema.core.metapath.item.node.INodeItem*
Q{http://csrc.nist.gov/ns/metaschema/metapath}string(arg1 as gov.nist.secauto.metaschema.core.metapath.item.atomic.IAnyAtomicItem?) as gov.nist.secauto.metaschema.core.metapath.item.atomic.IStringItem?
In namespace 'http://csrc.nist.gov/ns/metaschema/metapath-functions' as 'mp':
mp:abs(arg as gov.nist.secauto.metaschema.core.metapath.item.atomic.INumericItem?) as gov.nist.secauto.metaschema.core.metapath.item.atomic.INumericItem?
mp:avg(arg as gov.nist.secauto.metaschema.core.metapath.item.atomic.IAnyAtomicItem*) as gov.nist.secauto.metaschema.core.metapath.item.atomic.IAnyAtomicItem?
mp:base-uri() as gov.nist.secauto.metaschema.core.metapath.item.atomic.IAnyUriItem
mp:base-uri(arg1 as gov.nist.secauto.metaschema.core.metapath.item.node.INodeItem?) as gov.nist.secauto.metaschema.core.metapath.item.atomic.IAnyUriItem
mp:boolean(arg as gov.nist.secauto.metaschema.core.metapath.item.IItem*) as gov.nist.secauto.metaschema.core.metapath.item.atomic.IBooleanItem
mp:ceiling(arg as gov.nist.secauto.metaschema.core.metapath.item.atomic.INumericItem?) as gov.nist.secauto.metaschema.core.metapath.item.atomic.INumericItem?
mp:compare(comparand1 as gov.nist.secauto.metaschema.core.metapath.item.atomic.IStringItem?,comparand2 as gov.nist.secauto.metaschema.core.metapath.item.atomic.IStringItem?) as gov.nist.secauto.metaschema.core.metapath.item.atomic.IIntegerItem?
mp:concat(arg1 as gov.nist.secauto.metaschema.core.metapath.item.atomic.IAnyAtomicItem?,arg2 as gov.nist.secauto.metaschema.core.metapath.item.atomic.IAnyAtomicItem?, ...) as gov.nist.secauto.metaschema.core.metapath.item.atomic.IStringItem
mp:count(arg as gov.nist.secauto.metaschema.core.metapath.item.IItem*) as gov.nist.secauto.metaschema.core.metapath.item.atomic.IIntegerItem
mp:data() as gov.nist.secauto.metaschema.core.metapath.item.atomic.IAnyAtomicItem
mp:data(arg1 as gov.nist.secauto.metaschema.core.metapath.item.IItem*) as gov.nist.secauto.metaschema.core.metapath.item.atomic.IAnyAtomicItem
mp:doc(arg1 as gov.nist.secauto.metaschema.core.metapath.item.atomic.IStringItem?) as gov.nist.secauto.metaschema.core.metapath.item.node.IDocumentNodeItem
mp:document-uri() as gov.nist.secauto.metaschema.core.metapath.item.atomic.IAnyUriItem
mp:document-uri(arg1 as gov.nist.secauto.metaschema.core.metapath.item.node.IDocumentNodeItem?) as gov.nist.secauto.metaschema.core.metapath.item.atomic.IAnyUriItem
mp:empty(arg as gov.nist.secauto.metaschema.core.metapath.item.IItem*) as gov.nist.secauto.metaschema.core.metapath.item.atomic.IBooleanItem
mp:exists(arg as gov.nist.secauto.metaschema.core.metapath.item.IItem*) as gov.nist.secauto.metaschema.core.metapath.item.atomic.IBooleanItem
mp:false() as gov.nist.secauto.metaschema.core.metapath.item.atomic.IBooleanItem
mp:floor(arg1 as gov.nist.secauto.metaschema.core.metapath.item.atomic.INumericItem?) as gov.nist.secauto.metaschema.core.metapath.item.atomic.INumericItem?
mp:head(arg as gov.nist.secauto.metaschema.core.metapath.item.IItem*) as gov.nist.secauto.metaschema.core.metapath.item.IItem?
mp:insert-before(target as gov.nist.secauto.metaschema.core.metapath.item.IItem*,position as gov.nist.secauto.metaschema.core.metapath.item.atomic.IIntegerItem,inserts as gov.nist.secauto.metaschema.core.metapath.item.IItem*) as gov.nist.secauto.metaschema.core.metapath.item.IItem*
mp:max(arg as gov.nist.secauto.metaschema.core.metapath.item.atomic.IAnyAtomicItem*) as gov.nist.secauto.metaschema.core.metapath.item.atomic.IAnyAtomicItem?
mp:min(arg as gov.nist.secauto.metaschema.core.metapath.item.atomic.IAnyAtomicItem*) as gov.nist.secauto.metaschema.core.metapath.item.atomic.IAnyAtomicItem?
mp:not(arg as gov.nist.secauto.metaschema.core.metapath.item.IItem*) as gov.nist.secauto.metaschema.core.metapath.item.atomic.IBooleanItem
mp:path() as gov.nist.secauto.metaschema.core.metapath.item.atomic.IStringItem?
mp:path(arg1 as gov.nist.secauto.metaschema.core.metapath.item.node.INodeItem?) as gov.nist.secauto.metaschema.core.metapath.item.atomic.IStringItem?
mp:remove(target as gov.nist.secauto.metaschema.core.metapath.item.IItem*,position as gov.nist.secauto.metaschema.core.metapath.item.atomic.IIntegerItem) as gov.nist.secauto.metaschema.core.metapath.item.IItem*
mp:resolve-uri(relative as gov.nist.secauto.metaschema.core.metapath.item.atomic.IStringItem?) as gov.nist.secauto.metaschema.core.metapath.item.atomic.IAnyUriItem?
mp:resolve-uri(relative as gov.nist.secauto.metaschema.core.metapath.item.atomic.IStringItem?,base as gov.nist.secauto.metaschema.core.metapath.item.atomic.IStringItem) as gov.nist.secauto.metaschema.core.metapath.item.atomic.IAnyUriItem?
mp:reverse(target as gov.nist.secauto.metaschema.core.metapath.item.IItem*) as gov.nist.secauto.metaschema.core.metapath.item.IItem*
mp:round(arg as gov.nist.secauto.metaschema.core.metapath.item.atomic.INumericItem?) as gov.nist.secauto.metaschema.core.metapath.item.atomic.INumericItem?
mp:round(arg1 as gov.nist.secauto.metaschema.core.metapath.item.atomic.INumericItem?,precision as gov.nist.secauto.metaschema.core.metapath.item.atomic.IIntegerItem) as gov.nist.secauto.metaschema.core.metapath.item.atomic.INumericItem?
mp:starts-with(arg1 as gov.nist.secauto.metaschema.core.metapath.item.atomic.IStringItem?,arg2 as gov.nist.secauto.metaschema.core.metapath.item.atomic.IStringItem?) as gov.nist.secauto.metaschema.core.metapath.item.atomic.IBooleanItem
mp:static-base-uri(arg1 as gov.nist.secauto.metaschema.core.metapath.item.atomic.IStringItem?) as gov.nist.secauto.metaschema.core.metapath.item.atomic.IAnyUriItem
mp:sum(arg as gov.nist.secauto.metaschema.core.metapath.item.atomic.IAnyAtomicItem*) as gov.nist.secauto.metaschema.core.metapath.item.atomic.IAnyAtomicItem
mp:sum(arg as gov.nist.secauto.metaschema.core.metapath.item.atomic.IAnyAtomicItem*,zero as gov.nist.secauto.metaschema.core.metapath.item.atomic.IAnyAtomicItem?) as gov.nist.secauto.metaschema.core.metapath.item.atomic.IAnyAtomicItem?
mp:tail(arg as gov.nist.secauto.metaschema.core.metapath.item.IItem*) as gov.nist.secauto.metaschema.core.metapath.item.IItem*
mp:true() as gov.nist.secauto.metaschema.core.metapath.item.atomic.IBooleanItem
In namespace 'http://csrc.nist.gov/ns/metaschema/metapath-functions/array' as 'array':
array:append(array as gov.nist.secauto.metaschema.core.metapath.item.function.IArrayItem,appendage as gov.nist.secauto.metaschema.core.metapath.item.IItem*) as gov.nist.secauto.metaschema.core.metapath.item.function.IArrayItem
array:flatten(input as gov.nist.secauto.metaschema.core.metapath.item.IItem*) as gov.nist.secauto.metaschema.core.metapath.item.IItem*
array:get(array as gov.nist.secauto.metaschema.core.metapath.item.function.IArrayItem,position as gov.nist.secauto.metaschema.core.metapath.item.atomic.IIntegerItem) as gov.nist.secauto.metaschema.core.metapath.item.IItem?
array:head(array as gov.nist.secauto.metaschema.core.metapath.item.function.IArrayItem) as gov.nist.secauto.metaschema.core.metapath.item.IItem?
array:insert-before(array as gov.nist.secauto.metaschema.core.metapath.item.function.IArrayItem,position as gov.nist.secauto.metaschema.core.metapath.item.atomic.IIntegerItem,member as gov.nist.secauto.metaschema.core.metapath.item.IItem*) as gov.nist.secauto.metaschema.core.metapath.item.function.IArrayItem
array:join(array as gov.nist.secauto.metaschema.core.metapath.item.function.IArrayItem*) as gov.nist.secauto.metaschema.core.metapath.item.IItem?
array:put(array as gov.nist.secauto.metaschema.core.metapath.item.function.IArrayItem,position as gov.nist.secauto.metaschema.core.metapath.item.atomic.IIntegerItem,member as gov.nist.secauto.metaschema.core.metapath.item.IItem*) as gov.nist.secauto.metaschema.core.metapath.item.function.IArrayItem
array:remove(array as gov.nist.secauto.metaschema.core.metapath.item.function.IArrayItem,positions as gov.nist.secauto.metaschema.core.metapath.item.atomic.IIntegerItem*) as gov.nist.secauto.metaschema.core.metapath.item.function.IArrayItem
array:reverse(array as gov.nist.secauto.metaschema.core.metapath.item.function.IArrayItem) as gov.nist.secauto.metaschema.core.metapath.item.function.IArrayItem
array:size(array as gov.nist.secauto.metaschema.core.metapath.item.function.IArrayItem) as gov.nist.secauto.metaschema.core.metapath.item.atomic.IIntegerItem
array:subarray(array as gov.nist.secauto.metaschema.core.metapath.item.function.IArrayItem,start as gov.nist.secauto.metaschema.core.metapath.item.atomic.IIntegerItem) as gov.nist.secauto.metaschema.core.metapath.item.function.IArrayItem
array:subarray(array as gov.nist.secauto.metaschema.core.metapath.item.function.IArrayItem,start as gov.nist.secauto.metaschema.core.metapath.item.atomic.IIntegerItem,length as gov.nist.secauto.metaschema.core.metapath.item.atomic.IIntegerItem) as gov.nist.secauto.metaschema.core.metapath.item.function.IArrayItem
array:tail(array as gov.nist.secauto.metaschema.core.metapath.item.function.IArrayItem) as gov.nist.secauto.metaschema.core.metapath.item.IItem?
In namespace 'http://www.w3.org/2001/XMLSchema' as 'xs':
xs:NCName(arg1 as gov.nist.secauto.metaschema.core.metapath.item.atomic.IAnyAtomicItem?) as gov.nist.secauto.metaschema.core.metapath.item.atomic.INcNameItem?
xs:boolean(arg1 as gov.nist.secauto.metaschema.core.metapath.item.atomic.IAnyAtomicItem?) as gov.nist.secauto.metaschema.core.metapath.item.atomic.IBooleanItem?
xs:date(arg1 as gov.nist.secauto.metaschema.core.metapath.item.atomic.IAnyAtomicItem?) as gov.nist.secauto.metaschema.core.metapath.item.atomic.IDateItem?
xs:dateTime(arg1 as gov.nist.secauto.metaschema.core.metapath.item.atomic.IAnyAtomicItem?) as gov.nist.secauto.metaschema.core.metapath.item.atomic.IDateTimeItem?
xs:decimal(arg1 as gov.nist.secauto.metaschema.core.metapath.item.atomic.IAnyAtomicItem?) as gov.nist.secauto.metaschema.core.metapath.item.atomic.IDecimalItem?
xs:duration(arg1 as gov.nist.secauto.metaschema.core.metapath.item.atomic.IAnyAtomicItem?) as gov.nist.secauto.metaschema.core.metapath.item.atomic.IDurationItem?
xs:integer(arg1 as gov.nist.secauto.metaschema.core.metapath.item.atomic.IAnyAtomicItem?) as gov.nist.secauto.metaschema.core.metapath.item.atomic.IIntegerItem?
xs:nonNegativeInteger(arg1 as gov.nist.secauto.metaschema.core.metapath.item.atomic.IAnyAtomicItem?) as gov.nist.secauto.metaschema.core.metapath.item.atomic.INonNegativeIntegerItem?
xs:positiveInteger(arg1 as gov.nist.secauto.metaschema.core.metapath.item.atomic.IAnyAtomicItem?) as gov.nist.secauto.metaschema.core.metapath.item.atomic.IPositiveIntegerItem?
xs:string(arg1 as gov.nist.secauto.metaschema.core.metapath.item.atomic.IAnyAtomicItem?) as gov.nist.secauto.metaschema.core.metapath.item.atomic.IStringItem?

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • Have you squashed any non-relevant commits and commit messages? [instructions]
  • Do all automated CI/CD checks pass?

Changes to Core Features:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you included examples of how to use your new feature(s)?
  • Have you updated all website](https://pages.nist.gov/metaschema) and readme documentation affected by the changes you made? Changes to the website can be made in the website/content directory of your branch.

Summary by CodeRabbit

  • New Features

    • Added methods for auto-converting resources to specified formats and writing content to a Path or OutputStream.
    • Introduced commands for Metapath operations and listing Metapath functions in the CLI.
    • Enhanced CLI with a comprehensive set of Metaschema commands for various operations, including validation and schema generation.
  • Improvements

    • Updated CLI command handling to streamline command imports and execution.
    • Improved argument handling and descriptions for better clarity and usability.
  • Bug Fixes

    • Refined method names and argument representations for consistency and readability.
  • Tests

    • Added new test cases to ensure functionality for listing functions is robust and reliable.

Copy link

coderabbitai bot commented May 27, 2024

Walkthrough

Walkthrough

The recent changes focus on enhancing the functionality and usability of the Metaschema CLI and core libraries. Key updates include renaming methods for consistency, adding new methods for resource conversion, streamlining command imports, and refactoring file handling logic. Additionally, new commands and test cases have been introduced to improve Metaschema operations and validation processes.

Changes

File(s) Summary
FunctionLibrary.java, IFunctionLibrary.java Renamed getFunctionsAsStream method to stream.
FunctionService.java Added stream() method and updated constructor to use flatMap(IFunctionLibrary::stream).
IFunction.java Adjusted formatting of the toSignature method for argument representation.
IBoundLoader.java Added methods for auto-converting resources to a specified format and writing to Path or OutputStream.
CLI.java Replaced individual command imports with a single import for MetaschemaCommands. Refactored runCli method.
MetaschemaCommands.java Defined a class providing a list of commands for various metaschema operations.
AbstractConvertSubcommand.java Added imports, renamed arguments, and refactored source file handling logic.
AbstractValidateContentCommand.java Updated description of an extra argument in EXTRA_ARGUMENTS.
GenerateSchemaCommand.java Renamed an extra argument and adjusted URI cwd initialization.
ListFunctionsSubcommand.java, MetapathCommand.java Added methods and classes for listing Metapath functions and operations in the CLI.
CLITest.java Added a new test case to providesValues() method for listing functions.

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to full the review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review Details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits Files that changed from the base of the PR and between a0a647d and f7d5a45.
Files selected for processing (12)
  • core/src/main/java/gov/nist/secauto/metaschema/core/metapath/function/FunctionLibrary.java (1 hunks)
  • core/src/main/java/gov/nist/secauto/metaschema/core/metapath/function/FunctionService.java (3 hunks)
  • core/src/main/java/gov/nist/secauto/metaschema/core/metapath/function/IFunction.java (1 hunks)
  • core/src/main/java/gov/nist/secauto/metaschema/core/metapath/function/IFunctionLibrary.java (1 hunks)
  • databind/src/main/java/gov/nist/secauto/metaschema/databind/io/IBoundLoader.java (1 hunks)
  • metaschema-cli/src/main/java/gov/nist/secauto/metaschema/cli/CLI.java (2 hunks)
  • metaschema-cli/src/main/java/gov/nist/secauto/metaschema/cli/commands/AbstractConvertSubcommand.java (5 hunks)
  • metaschema-cli/src/main/java/gov/nist/secauto/metaschema/cli/commands/AbstractValidateContentCommand.java (2 hunks)
  • metaschema-cli/src/main/java/gov/nist/secauto/metaschema/cli/commands/GenerateSchemaCommand.java (3 hunks)
  • metaschema-cli/src/main/java/gov/nist/secauto/metaschema/cli/commands/metapath/ListFunctionsSubcommand.java (1 hunks)
  • metaschema-cli/src/main/java/gov/nist/secauto/metaschema/cli/commands/metapath/MetapathCommand.java (1 hunks)
  • metaschema-cli/src/test/java/gov/nist/secauto/metaschema/cli/CLITest.java (1 hunks)
Files skipped from review due to trivial changes (5)
  • core/src/main/java/gov/nist/secauto/metaschema/core/metapath/function/FunctionLibrary.java
  • core/src/main/java/gov/nist/secauto/metaschema/core/metapath/function/IFunction.java
  • core/src/main/java/gov/nist/secauto/metaschema/core/metapath/function/IFunctionLibrary.java
  • metaschema-cli/src/main/java/gov/nist/secauto/metaschema/cli/commands/AbstractValidateContentCommand.java
  • metaschema-cli/src/main/java/gov/nist/secauto/metaschema/cli/commands/metapath/MetapathCommand.java
Additional comments not posted (12)
metaschema-cli/src/main/java/gov/nist/secauto/metaschema/cli/CLI.java (2)

32-32: Added import for MetapathCommand.

This import is necessary for the new CLI command to function.


63-63: Added MetapathCommand to command handlers.

This change integrates the new MetapathCommand into the CLI, enabling the new functionality as described in the PR.

core/src/main/java/gov/nist/secauto/metaschema/core/metapath/function/FunctionService.java (2)

68-68: Updated method call from getFunctionsAsStream to stream.

This change aligns with the renaming of the method in the IFunctionLibrary interface, improving consistency across the codebase.


83-85: Added new stream method in FunctionService.

This method provides a streamlined way to access functions, enhancing the modularity and maintainability of the code.

metaschema-cli/src/main/java/gov/nist/secauto/metaschema/cli/commands/metapath/ListFunctionsSubcommand.java (1)

52-131: Implemented ListFunctionsSubcommand for listing Metapath functions.

The implementation correctly gathers and formats the function details for display, adhering to the requirements specified in the PR. The use of logging and structured data collection enhances the clarity and usability of the command.

metaschema-cli/src/main/java/gov/nist/secauto/metaschema/cli/commands/AbstractConvertSubcommand.java (2)

Line range hint 40-52: Added imports for URI handling.

These imports are necessary for the new URI handling logic in the command, which improves the robustness of source file processing.


183-191: Refactored URI handling logic in AbstractConvertSubcommand.

This refactor enhances the command's ability to handle different types of sources (files and URLs) more reliably and provides clearer error messages on failures.

metaschema-cli/src/test/java/gov/nist/secauto/metaschema/cli/CLITest.java (1)

144-146: Added test case for the list-functions command in CLITest.

This addition ensures that the new command is covered by automated tests, which is crucial for maintaining the reliability of the CLI functionality.

metaschema-cli/src/main/java/gov/nist/secauto/metaschema/cli/commands/GenerateSchemaCommand.java (2)

102-102: Renamed extra argument to metaschema-module-file-or-URL.

This renaming clarifies the expected input for the command, which can now accept both local files and URLs, enhancing the command's flexibility.


214-214: Updated URI handling in GenerateSchemaCommand.

This update improves the command's robustness in handling different types of input sources, ensuring that the command can handle both local and remote files effectively.

databind/src/main/java/gov/nist/secauto/metaschema/databind/io/IBoundLoader.java (2)

526-559: The implementation of the convert method using URI and Path parameters is correct and well-documented.


561-593: The implementation of the convert method using URI and OutputStream parameters is correct and well-documented.

@david-waltermire david-waltermire marked this pull request as ready for review May 27, 2024 01:49
@david-waltermire david-waltermire force-pushed the feature-list-metapath-functions branch from f7d5a45 to b340ea4 Compare May 27, 2024 02:03
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review Details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits Files that changed from the base of the PR and between f7d5a45 and b340ea4.
Files selected for processing (12)
  • core/src/main/java/gov/nist/secauto/metaschema/core/metapath/function/FunctionLibrary.java (1 hunks)
  • core/src/main/java/gov/nist/secauto/metaschema/core/metapath/function/FunctionService.java (3 hunks)
  • core/src/main/java/gov/nist/secauto/metaschema/core/metapath/function/IFunction.java (1 hunks)
  • core/src/main/java/gov/nist/secauto/metaschema/core/metapath/function/IFunctionLibrary.java (1 hunks)
  • databind/src/main/java/gov/nist/secauto/metaschema/databind/io/IBoundLoader.java (1 hunks)
  • metaschema-cli/src/main/java/gov/nist/secauto/metaschema/cli/CLI.java (2 hunks)
  • metaschema-cli/src/main/java/gov/nist/secauto/metaschema/cli/commands/AbstractConvertSubcommand.java (5 hunks)
  • metaschema-cli/src/main/java/gov/nist/secauto/metaschema/cli/commands/AbstractValidateContentCommand.java (2 hunks)
  • metaschema-cli/src/main/java/gov/nist/secauto/metaschema/cli/commands/GenerateSchemaCommand.java (3 hunks)
  • metaschema-cli/src/main/java/gov/nist/secauto/metaschema/cli/commands/metapath/ListFunctionsSubcommand.java (1 hunks)
  • metaschema-cli/src/main/java/gov/nist/secauto/metaschema/cli/commands/metapath/MetapathCommand.java (1 hunks)
  • metaschema-cli/src/test/java/gov/nist/secauto/metaschema/cli/CLITest.java (1 hunks)
Files skipped from review due to trivial changes (1)
  • core/src/main/java/gov/nist/secauto/metaschema/core/metapath/function/IFunction.java
Files skipped from review as they are similar to previous changes (11)
  • core/src/main/java/gov/nist/secauto/metaschema/core/metapath/function/FunctionLibrary.java
  • core/src/main/java/gov/nist/secauto/metaschema/core/metapath/function/FunctionService.java
  • core/src/main/java/gov/nist/secauto/metaschema/core/metapath/function/IFunctionLibrary.java
  • databind/src/main/java/gov/nist/secauto/metaschema/databind/io/IBoundLoader.java
  • metaschema-cli/src/main/java/gov/nist/secauto/metaschema/cli/CLI.java
  • metaschema-cli/src/main/java/gov/nist/secauto/metaschema/cli/commands/AbstractConvertSubcommand.java
  • metaschema-cli/src/main/java/gov/nist/secauto/metaschema/cli/commands/AbstractValidateContentCommand.java
  • metaschema-cli/src/main/java/gov/nist/secauto/metaschema/cli/commands/GenerateSchemaCommand.java
  • metaschema-cli/src/main/java/gov/nist/secauto/metaschema/cli/commands/metapath/ListFunctionsSubcommand.java
  • metaschema-cli/src/main/java/gov/nist/secauto/metaschema/cli/commands/metapath/MetapathCommand.java
  • metaschema-cli/src/test/java/gov/nist/secauto/metaschema/cli/CLITest.java

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review Details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits Files that changed from the base of the PR and between b340ea4 and 05c1874.
Files selected for processing (2)
  • metaschema-cli/src/main/java/gov/nist/secauto/metaschema/cli/CLI.java (2 hunks)
  • metaschema-cli/src/main/java/gov/nist/secauto/metaschema/cli/commands/MetaschemaCommands.java (1 hunks)
Files skipped from review due to trivial changes (2)
  • metaschema-cli/src/main/java/gov/nist/secauto/metaschema/cli/CLI.java
  • metaschema-cli/src/main/java/gov/nist/secauto/metaschema/cli/commands/MetaschemaCommands.java

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review Details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits Files that changed from the base of the PR and between 05c1874 and 68daf11.
Files selected for processing (1)
  • metaschema-cli/src/main/java/gov/nist/secauto/metaschema/cli/commands/MetaschemaCommands.java (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • metaschema-cli/src/main/java/gov/nist/secauto/metaschema/cli/commands/MetaschemaCommands.java

@david-waltermire david-waltermire merged commit 240beb5 into metaschema-framework:develop May 27, 2024
1 check passed
@david-waltermire david-waltermire deleted the feature-list-metapath-functions branch May 27, 2024 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant