Git Product home page Git Product logo

openapi's People

Contributors

bocasti avatar chaetal avatar christian2denker avatar noha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

openapi's Issues

missing enum

We are missing enum type like:

#OASchema>>enum: #(this is an enum)

Add support fur custom validation per property

JSON schema defines properties for type and some value formats. The code should be flexible enough so it is possible to define custom constraints and add it to a property. Custom constraints should carry a label that can be added in e.g. the description

Missing an Unit schema

A unit schema is property value (a number) and property unit (an enum).

Would be useful to define volume Units, distance units etc as json schema. It should be easy to add properties like ranges etc on top

Installation and use docs

Hello and congrats for your project! It seems you are pioneering openapi in Smalltalk :) I would like to try to use your project for both, generating the docs and generating the API code in Smalltalk. Just in case, do you have some base guidelines to generate the code? This is what I did right now (it could be useful for the readme if you think it can help other developers):

  1. Use Iceberg to load the repo. It is simpler via https
  2. Click on the repo > Metacello > Install baseline
  3. You can check the tests, or you can set up a server from the Playground with the example API, and check it from your Web browser:

server := ZnServer startOn: 1700 + 10 atRandom.
server delegate:
(ZnRestServerDelegate new
uriSpace: ( OpenAPIUriSpace new
rootClass: OpenAPICall;
yourself )).

Pet instances add: (Pet new id: 1; name: 'a'; age: 1).
Pet instances add: (Pet new id: 2; name: 'a'; age: 2).

server localUrl. // e.g. Visit http://localhost:1710/pets/01

  1. If you want to load your own OpenAPI specification, lets say:
    fileContent := '{ "openapi": "3.0.0", ...}'.

You can do it by loading from a string:
api := OpenAPI fromString: fileContent.

Bue then... I couldn't find the way to generate the supporting classes (e.g. Pet, OpenAPISpecCall, etc). Or is it something we should manually create?

Thanks!

Fix exception handling for calls

Since the separation of JSON schema and OpenAPI the exception handling is not working as expected. There are new exception from JSON schema that should be caught as well. Most constraint errors or type errors could be automatically translated into 400 status code responses with error description

Add operation wide constraints

At the moment we only have JSON schema type and value constraints per property. An additional checking of constraints for the resulting object is needed

Factor out JSON schema

OpenAPI has been implemented from scratch as OpenAPI without determine which of the structure is lend from JSON schema. Both should be separated and packaged in separate repositories

Error In Pharo 7 Installing via Baseline

When I run:

Metacello new
    baseline: 'OpenAPI';
    repository: 'github://zweidenker/OpenAPI/';
    load.

I am getting what appears to be an Ombu error:

ZnBufferedReadWriteStream(Object)>>doesNotUnderstand: #defaultBufferSize
ZnBufferedReadWriteStream>>on:
ZnBufferedReadWriteStream class>>on:
FileReference>>binaryReadWriteStream
[ | initialPosition initialLocalName fileStream |
self entryBuffer isEmpty
	ifTrue: [ ^ self ].
fileStream := ZnCharacterReadWriteStream
	on: fileReference binaryReadWriteStream
	encoding: #utf8.
[ | anEntryWriter |
fileStream setToEnd.
initialPosition := fileStream position.
initialLocalName := self entryBuffer first value.
anEntryWriter := self newEntryWriter.
[ self entryBuffer isEmpty ]
	whileFalse: [ | next entry |
		next := self entryBuffer removeFirst.
		entry := next key.

		"Write entry to file"
		anEntryWriter on: fileStream nextEntryPut: entry ].

"In Linux it was necessary to explicitely flush the file stream"
fileStream flush.
lastStreamPosition := fileStream size ]
	ensure: [ fileStream close ].
self
	refreshEntryPositionsByLocalNameStartingAt: initialPosition
	since: initialLocalName ] in OmBlockFileStore(OmFileStore)>>flushEntryBuffer in Block: [ | initialPosition initialLocalName fileStream |...
[ caught := true.
self wait.
blockValue := mutuallyExcludedBlock value ] in Semaphore>>critical: in Block: [ caught := true....
BlockClosure>>ensure:
Semaphore>>critical:
OmBlockFileStore(OmFileStore)>>critical:
OmBlockFileStore(OmFileStore)>>flushEntryBuffer
OmDeferrer>>sendMessage
[ self sendMessage ] in OmDeferrer>>flush in Block: [ self sendMessage ]
BlockClosure>>ensure:
OmDeferrer>>flush
[ "Loop until enough time passed since last #schedule"
[ DateAndTime now < (lastSchedule + duration) ]
	whileTrue: [ duration wait ].

"Execute deferred action (if not flushed before) and clean up"
self flush ] in OmDeferrer>>runMessageProcess in Block: [ "Loop until enough time passed since last #sched...etc...
[ self value.
Processor terminateActive ] in BlockClosure>>newProcess in Block: [ self value....

Remove NeoJSON parsing for $refs

Current NeoJSON materialization tries to detect $ref elements directly which does not work. There is now a visitor doing it properly. Left-overs from the old handling need to be removed

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.