mirror of
https://github.com/LukeHagar/connexion.git
synced 2025-12-06 12:27:45 +00:00
Connexion 2.0 (#619)
- App and Api options must be provided through the "options" argument (``old_style_options`` have been removed). - You must specify a form content-type in 'consumes' in order to consume form data. - The `Operation` interface has been formalized in the `AbstractOperation` class. - The `Operation` class has been renamed to `Swagger2Operation`. - Array parameter deserialization now follows the Swagger 2.0 spec more closely. In situations when a query parameter is passed multiple times, and the collectionFormat is either csv or pipes, the right-most value will be used. For example, `?q=1,2,3&q=4,5,6` will result in `q = [4, 5, 6]`. The old behavior is available by setting the collectionFormat to `multi`, or by importing `decorators.uri_parsing.AlwaysMultiURIParser` and passing `parser_class=AlwaysMultiURIParser` to your Api. - The spec validator library has changed from `swagger-spec-validator` to `openapi-spec-validator`. - Errors that previously raised `SwaggerValidationError` now raise the `InvalidSpecification` exception. All spec validation errors should be wrapped with `InvalidSpecification`. - Support for nullable/x-nullable, readOnly and writeOnly/x-writeOnly has been added to the standard json schema validator. - Custom validators can now be specified on api level (instead of app level). - Added support for basic authentication and apikey authentication - If unsupported security requirements are defined or ``x-tokenInfoFunc``/``x-tokenInfoUrl`` is missing, connexion now denies requests instead of allowing access without security-check. - Accessing ``connexion.request.user`` / ``flask.request.user`` is no longer supported, use ``connexion.context['user']`` instead
This commit is contained in:
@@ -1,32 +0,0 @@
|
||||
from sqlalchemy import Column, DateTime, String, create_engine
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
from sqlalchemy.orm import scoped_session, sessionmaker
|
||||
|
||||
Base = declarative_base()
|
||||
|
||||
|
||||
class Pet(Base):
|
||||
__tablename__ = 'pets'
|
||||
id = Column(String(20), primary_key=True)
|
||||
name = Column(String(100))
|
||||
animal_type = Column(String(20))
|
||||
created = Column(DateTime())
|
||||
|
||||
def update(self, id=None, name=None, animal_type=None, tags=None, created=None):
|
||||
if name is not None:
|
||||
self.name = name
|
||||
if animal_type is not None:
|
||||
self.animal_type = animal_type
|
||||
if created is not None:
|
||||
self.created = created
|
||||
|
||||
def dump(self):
|
||||
return dict([(k, v) for k, v in vars(self).items() if not k.startswith('_')])
|
||||
|
||||
|
||||
def init_db(uri):
|
||||
engine = create_engine(uri, convert_unicode=True)
|
||||
db_session = scoped_session(sessionmaker(autocommit=False, autoflush=False, bind=engine))
|
||||
Base.query = db_session.query_property()
|
||||
Base.metadata.create_all(bind=engine)
|
||||
return db_session
|
||||
Reference in New Issue
Block a user