Skip to content

Commit 11d35b7

Browse files
Add files via upload
1 parent 23718ba commit 11d35b7

File tree

1 file changed

+88
-0
lines changed

1 file changed

+88
-0
lines changed

src/Microsoft.OpenApi.Hidi/readme.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# Overview
2+
3+
Hidi is a command line tool that makes it easy to work with and transform OpenAPI documents. The tool enables you validate and apply transformations to and from different file formats using various commands to do different actions on the files.
4+
5+
## Capabilities
6+
Hidi has these key capabilities that enable you to build different scenarios off the tool
7+
• Validation of OpenAPI files
8+
• Conversion of OpenAPI files into different file formats: convert files from JSON to YAML, YAML to JSON
9+
• Slice or filter OpenAPI documents to smaller subsets using operationIDs and tags
10+
11+
12+
## Installation
13+
14+
Install [Microsoft.OpenApi.Hidi](https://www.nuget.org/packages/Microsoft.OpenApi.Hidi/1.0.0-preview4) package from NuGet by running the following command:
15+
16+
### .NET CLI(Global)
17+
1. dotnet tool install --global Microsoft.OpenApi.Hidi --version 0.5.0-preview4
18+
19+
### .NET CLI(local)
20+
21+
1. dotnet new tool-manifest #if you are setting up the OpenAPI.NET repo
22+
2. dotnet tool install --local Microsoft.OpenApi.Hidi --version 0.5.0-preview4
23+
24+
25+
26+
## How to use Hidi
27+
Once you've installed the package locally, you can invoke the Hidi by running: hidi [command].
28+
You can access the list of command options we have by running hidi -h
29+
The tool avails the following commands:
30+
31+
• Validate
32+
• Transform
33+
34+
### Validate
35+
This command option accepts an OpenAPI document as an input parameter, visits multiple OpenAPI elements within the document and returns statistics count report on the following elements:
36+
37+
• Path Items
38+
• Operations
39+
• Parameters
40+
• Request bodies
41+
• Responses
42+
• Links
43+
• Callbacks
44+
• Schemas
45+
46+
It accepts the following command:
47+
48+
• --openapi(-d) - OpenAPI description file path or URL
49+
• --loglevel(-ll) - The log level to use when logging messages to the main output
50+
51+
52+
**Example:** hidi.exe validate --openapi C:\OpenApidocs\Mail.yml --loglevel trace
53+
Run validate -h to see the options available.
54+
55+
### Transform
56+
Used to convert file formats from JSON to YAML and vice versa and performs slicing of OpenAPI documents.
57+
58+
This command accepts the following parameters:
59+
60+
• --openapi(-d) - OpenAPI description file path in the local filesystem or a valid URL hosted on a HTTPS server
61+
• --csdl(-cs) - CSDL file path in the local filesystem or a valid URL hosted on a HTTPS server
62+
• --csdlfilter(-csf) - a filter parameter that a user can use to select a subset of a large CSDL file. They do so by providing a comma delimited list of EntitySet and Singleton names that appear in the EntityContainer.
63+
• --output(-o) - Output directory path for the transformed document
64+
• --clean-ouput(-co) - an optional param that allows a user to overwrite an existing file.
65+
• --version(-v) - OpenAPI specification version
66+
• --format(-f) - File format
67+
• --loglevel(-ll) - The log level to use when logging messages to the main output
68+
• --inline(-i) - Inline $ref instances
69+
• --resolveExternal(-ex) - Resolve external $refs
70+
• --filterByOperationIds(-op) - Slice document based on OperationId(s) provided. Accepts a comma delimited list of operation ids.
71+
• --filterByTags(-t) - Slice document based on tag(s) provided. Accepts a comma delimited list of tags.
72+
• --filterByCollection(-c) - Slices the OpenAPI document based on the Postman Collection file generated by Resource Explorer
73+
74+
**Examples:**
75+
76+
1. Filtering by OperationIds
77+
hidi transform -d files\People.yml -f yaml -o files\People.yml -v OpenApi3_0 -op users_UpdateInsights -co
78+
79+
2. Filtering by Postman collection
80+
hidi transform --openapi files\People.yml --format yaml --output files\People2.yml --version OpenApi3_0 --filterByCollection Graph-Collection-0017059134807617005.postman_collection.json
81+
82+
3. CSDL--->OpenAPI conversion and filtering
83+
hidi transform --input Files/Todo.xml --output Files/Todo-subset.yml --format yaml --version OpenApi3_0 --filterByOperationIds Todos.Todo.UpdateTodo
84+
85+
4. CSDL Filtering by EntitySets and Singletons
86+
hidi transform -cs dataverse.csdl --csdlFilter "appointments,opportunities" -o appointmentsAndOpportunities.yaml -ll trace
87+
88+
Run transform -h to see all the available usage options.

0 commit comments

Comments
 (0)