Skip to content

Commit b3e4937

Browse files
authored
Merge pull request #874 from microsoft/readme-patch-1
Add Hidi read me file
2 parents 23718ba + c1a0bfd commit b3e4937

File tree

1 file changed

+91
-0
lines changed

1 file changed

+91
-0
lines changed

src/Microsoft.OpenApi.Hidi/readme.md

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
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 --prerelease
18+
19+
20+
### .NET CLI(local)
21+
22+
1. dotnet new tool-manifest #if you are setting up the OpenAPI.NET repo
23+
2. dotnet tool install --local Microsoft.OpenApi.Hidi --prerelease
24+
25+
26+
27+
28+
## How to use Hidi
29+
Once you've installed the package locally, you can invoke the Hidi by running: hidi [command].
30+
You can access the list of command options we have by running hidi -h
31+
The tool avails the following commands:
32+
33+
• Validate
34+
• Transform
35+
36+
### Validate
37+
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:
38+
39+
• Path Items
40+
• Operations
41+
• Parameters
42+
• Request bodies
43+
• Responses
44+
• Links
45+
• Callbacks
46+
• Schemas
47+
48+
It accepts the following command:
49+
50+
• --openapi(-d) - OpenAPI description file path or URL
51+
• --loglevel(-ll) - The log level to use when logging messages to the main output
52+
53+
54+
**Example:** `hidi.exe validate --openapi C:\OpenApidocs\Mail.yml --loglevel trace`
55+
56+
Run validate -h to see the options available.
57+
58+
### Transform
59+
Used to convert file formats from JSON to YAML and vice versa and performs slicing of OpenAPI documents.
60+
61+
This command accepts the following parameters:
62+
63+
• --openapi(-d) - OpenAPI description file path in the local filesystem or a valid URL hosted on a HTTPS server
64+
• --csdl(-cs) - CSDL file path in the local filesystem or a valid URL hosted on a HTTPS server
65+
• --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.
66+
• --output(-o) - Output directory path for the transformed document
67+
• --clean-ouput(-co) - an optional param that allows a user to overwrite an existing file.
68+
• --version(-v) - OpenAPI specification version
69+
• --format(-f) - File format
70+
• --loglevel(-ll) - The log level to use when logging messages to the main output
71+
• --inline(-i) - Inline $ref instances
72+
• --resolveExternal(-ex) - Resolve external $refs
73+
• --filterByOperationIds(-op) - Slice document based on OperationId(s) provided. Accepts a comma delimited list of operation ids.
74+
• --filterByTags(-t) - Slice document based on tag(s) provided. Accepts a comma delimited list of tags.
75+
• --filterByCollection(-c) - Slices the OpenAPI document based on the Postman Collection file generated by Resource Explorer
76+
77+
**Examples:**
78+
79+
1. Filtering by OperationIds
80+
hidi transform -d files\People.yml -f yaml -o files\People.yml -v OpenApi3_0 -op users_UpdateInsights -co
81+
82+
2. Filtering by Postman collection
83+
hidi transform --openapi files\People.yml --format yaml --output files\People2.yml --version OpenApi3_0 --filterByCollection Graph-Collection-0017059134807617005.postman_collection.json
84+
85+
3. CSDL--->OpenAPI conversion and filtering
86+
hidi transform --input Files/Todo.xml --output Files/Todo-subset.yml --format yaml --version OpenApi3_0 --filterByOperationIds Todos.Todo.UpdateTodo
87+
88+
4. CSDL Filtering by EntitySets and Singletons
89+
hidi transform -cs dataverse.csdl --csdlFilter "appointments,opportunities" -o appointmentsAndOpportunities.yaml -ll trace
90+
91+
Run transform -h to see all the available usage options.

0 commit comments

Comments
 (0)