Skip to content

v0.3.4

Latest
Compare
Choose a tag to compare
@skryukov skryukov released this 14 Jan 12:02
40b08bd

Added

  • Experimental support for readOnly and writeOnly keywords. (@skryukov)

    # spec/rails_helper.rb
    
    RSpec.configure do |config|
      # To enable support for readOnly and writeOnly keywords, pass `enforce_access_modes: true` option:
      config.include Skooma::RSpec[Rails.root.join("docs", "openapi.yml"), enforce_access_modes: true], type: :request
    end

The enforce_access_modes option enables using one schema for both request and response bodies. For example, this schema will expect exactly {name, password} for POST/PUT request bodies and {id, name} for responses:

components:
  schemas:
    User:
      type: object
      required: [id, name, password]
      additionalProperties: false
      properties:
        id:
          type: integer
          format: int64
          readOnly: true
        name:
          type: string
        password:
          type: string
          writeOnly: true

Full Changelog: v0.3.3...v0.3.4