You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Explain what the gem does and add example output
- Add Related Projects section linking to grape ecosystem
- Add Compatibility section with version table
- Add usage examples for basic entities, custom descriptions, and references
- Document all available documentation options
- Expand table of contents with subsections
- Add reference to CONTRIBUTING.md
Fixes#58
Copy file name to clipboardExpand all lines: README.md
+115-4Lines changed: 115 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,15 +6,62 @@
6
6
## Table of Contents
7
7
8
8
-[What is grape-swagger-entity?](#what-is-grape-swagger-entity)
9
+
-[Related Projects](#related-projects)
10
+
-[Compatibility](#compatibility)
9
11
-[Installation](#installation)
12
+
-[Usage](#usage)
13
+
-[Basic Entity](#basic-entity)
14
+
-[Custom Model Description](#custom-model-description)
15
+
-[Entity References](#entity-references)
16
+
-[Documentation Options](#documentation-options)
10
17
-[Development](#development)
11
18
-[Contributing](#contributing)
12
19
-[License](#license)
13
20
14
-
15
21
## What is grape-swagger-entity?
16
22
17
-
A simple grape-swagger adapter to allow parse representers as response model
23
+
This gem provides an adapter for [grape-swagger](https://github.com/ruby-grape/grape-swagger) that allows parsing [grape-entity](https://github.com/ruby-grape/grape-entity) classes to generate OpenAPI/Swagger model definitions automatically.
24
+
25
+
### What it does
26
+
27
+
- Generates `definitions` in your Swagger JSON from Grape::Entity exposures
28
+
- Maps entity properties to OpenAPI schema properties with types and descriptions
29
+
- Handles nested entities and entity references via `$ref`
30
+
- Supports arrays, required fields, and documentation options
The following options are available in the `documentation` hash:
128
+
129
+
| Option | Description |
130
+
|--------|-------------|
131
+
|`type`| OpenAPI data type (`String`, `Integer`, `Boolean`, etc.) |
132
+
|`desc`| Property description |
133
+
|`required`| Whether field is required (default: based on expose options) |
134
+
|`is_array`| Marks field as array type |
135
+
|`read_only`| Marks field as read-only |
136
+
|`values`| Enum values for the field |
137
+
|`example`| Example value |
138
+
|`default`| Default value |
139
+
|`minimum`| Minimum value for numeric types |
140
+
|`maximum`| Maximum value for numeric types |
141
+
|`min_length`| Minimum length for string types |
142
+
|`max_length`| Maximum length for string types |
143
+
|`hidden`| Hide field from documentation |
144
+
35
145
## Development
36
146
37
147
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rspec` to run the tests. You can also run `bin/pry` for an interactive prompt that will allow you to experiment.
38
148
39
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
149
+
To install this gem onto your local machine, run `bundle exec rake install`.
40
150
41
151
## Contributing
42
152
43
153
Bug reports and pull requests are welcome on GitHub at https://github.com/ruby-grape/grape-swagger-entity.
44
154
155
+
See [CONTRIBUTING](CONTRIBUTING.md) for more information.
156
+
45
157
## License
46
158
47
159
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
0 commit comments