README excerpt
# OpenAPI for Pharo
[](https://github.com/nicolashlad/pharo-openapi-generator/actions/workflows/ci-pharo12.yml)
A Pharo Smalltalk implementation of the OpenAPI specification.
## Installation
You can load the OpenAPI project into your Pharo image using Metacello:
```smalltalk
Metacello new
baseline: 'OpenAPI';
repository: 'github://nicolashlad/pharo-openapi-generator:main';
load.
```
You can also load specific groups:
```smalltalk
"Load only the core functionality"
Metacello new
baseline: 'OpenAPI';
repository: 'github://nicolashlad/pharo-openapi-generator:main';
load: 'Core'.
"Load the REST components"
Metacello new
baseline: 'OpenAPI';
repository: 'github://nicolashlad/pharo-openapi-generator:main';
load: 'REST'.
"Load the client components"
Metacello new
baseline: 'OpenAPI';
repository: 'github://nicolashlad/pharo-openapi-generator:main';
load: 'Client'.
"Load with tests"
Metacello new
baseline: 'OpenAPI';
repository: 'github://nicolashlad/pharo-openapi-generator:main';
load: 'Tests'.
```
## Running Tests
You can run the tests using the Pharo Test Runner or with the following code:
```smalltalk
"Run all OpenAPI tests"
OpenAPITest suite run.
OALicenseTest suite run.
OAContactTest suite run.
OAInfoTest suite run.
OAErrorTest suite run.
OAVisitorTest suite run.
OAReferenceResolveVisitorTest suite run.
OpenApiClientTest suite run.
OARequestBuilderTest suite run.
OARESTTest suite run.
"Or run all tests in a package"
'OpenAPI-Core-Tests' asPackage tests do: [ :test | test run ].
'OpenAPI-REST-Tests' asPackage tests do: [ :test | test run ].
```
## Usage
```smalltalk
"Parse an OpenAPI specification from a string"
api := OpenAPI fromString: '{"openapi": "3.0.0", "info": {"title": "Test API", "version": "1.0.0"}}'.
"Get the title of the API"
api info title. "=> 'Test API'"
"Get the version of the API"
api info version. "=> '1.0.0'"
"Create a client for the API"
client := OpenApiClient new
baseUri: 'https://api.example.com';
openApi: api;
yourself.
```
## Project Structure
- `OpenAPI-Core`: Core functionality for parsing and working with OpenAPI specifications
- `OpenAPI-REST`: REST-related functionality for OpenAPI
- `OpenAPI-Client`: Client for consuming OpenAPI-defined APIs
- `OpenAPI-Core-Tests`: Tests for the core functionality
- `OpenAPI-REST-Tests`: Tests for the REST functionality
## Dependencies
- [JSONSchema](https://github.com/zweidenker/JSONSchema): For JSON Schema validation
- [NeoJSON](https://github.com/svenvc/NeoJSON): For JSON parsing
- [Zinc HTTP Components](https://github.com/svenvc/zinc): For HTTP functionality
- [Mocketry](https://github.com/dionisiydk/Mocketry): For testing
## Continuous Integration
This project uses GitHub Actions with SmalltalkCI to run tests on Pharo 12. The CI workflow is defined in `.github/workflows/ci-pharo12.yml` and the SmalltalkCI configuration is in `.smalltalk.ston`.
The CI workflow runs automatically on pushes to the main branch and on pull requests.
## License
MIT License. See LICENSE file for details.