mirror of
				https://github.com/graphql-python/graphene.git
				synced 2025-11-04 01:47:45 +03:00 
			
		
		
		
	Merge pull request #294 from mwilliamson/patch-1
Clarify indentation in UPGRADE-v1.0.md
This commit is contained in:
		
						commit
						51eb2e593f
					
				| 
						 | 
					@ -12,43 +12,43 @@ We have done our best to provide backwards compatibility with deprecated APIs.
 | 
				
			||||||
## Deprecations
 | 
					## Deprecations
 | 
				
			||||||
 | 
					
 | 
				
			||||||
* `with_context` is no longer needed. Resolvers now always take the context argument.
 | 
					* `with_context` is no longer needed. Resolvers now always take the context argument.
 | 
				
			||||||
Before:
 | 
					  Before:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```python
 | 
					  ```python
 | 
				
			||||||
def resolve_xxx(self, args, info):
 | 
					  def resolve_xxx(self, args, info):
 | 
				
			||||||
    # ...
 | 
					      # ...
 | 
				
			||||||
```
 | 
					  ```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
With 1.0:
 | 
					  With 1.0:
 | 
				
			||||||
```python
 | 
					  ```python
 | 
				
			||||||
def resolve_xxx(self, args, context, info):
 | 
					  def resolve_xxx(self, args, context, info):
 | 
				
			||||||
    # ...
 | 
					      # ...
 | 
				
			||||||
```
 | 
					  ```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
* `ObjectType` and `Interface` no longer accept the `abstract` option in the `Meta`.
 | 
					* `ObjectType` and `Interface` no longer accept the `abstract` option in the `Meta`.
 | 
				
			||||||
  Inheriting fields should be now achieved using `AbstractType` inheritance.
 | 
					  Inheriting fields should be now achieved using `AbstractType` inheritance.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Before:
 | 
					  Before:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```python
 | 
					  ```python
 | 
				
			||||||
class MyBaseQuery(graphene.ObjectType):
 | 
					  class MyBaseQuery(graphene.ObjectType):
 | 
				
			||||||
    my_field = String()
 | 
					      my_field = String()
 | 
				
			||||||
    class Meta:
 | 
					      class Meta:
 | 
				
			||||||
        abstract = True
 | 
					          abstract = True
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class Query(MyBaseQuery):
 | 
					  class Query(MyBaseQuery):
 | 
				
			||||||
    pass
 | 
					      pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```
 | 
					  ```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
With 1.0:
 | 
					  With 1.0:
 | 
				
			||||||
```python
 | 
					  ```python
 | 
				
			||||||
class MyBaseQuery(graphene.AbstractType):
 | 
					  class MyBaseQuery(graphene.AbstractType):
 | 
				
			||||||
    my_field = String()
 | 
					      my_field = String()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class Query(MyBaseQuery, graphene.ObjectType):
 | 
					  class Query(MyBaseQuery, graphene.ObjectType):
 | 
				
			||||||
    pass
 | 
					      pass
 | 
				
			||||||
```
 | 
					  ```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
* The `type_name` option in the Meta in types is now `name`
 | 
					* The `type_name` option in the Meta in types is now `name`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -145,14 +145,14 @@ For installing, you have to replace the old `graphene[django]` with `graphene-dj
 | 
				
			||||||
* As the package is now independent, you have to import now from `graphene_django`.
 | 
					* As the package is now independent, you have to import now from `graphene_django`.
 | 
				
			||||||
* **DjangoNode no longer exists**, please use `relay.Node` instead:
 | 
					* **DjangoNode no longer exists**, please use `relay.Node` instead:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```python
 | 
					  ```python
 | 
				
			||||||
from graphene.relay import Node
 | 
					  from graphene.relay import Node
 | 
				
			||||||
from graphene_django import DjangoObjectType
 | 
					  from graphene_django import DjangoObjectType
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class Droid(DjangoObjectType):
 | 
					  class Droid(DjangoObjectType):
 | 
				
			||||||
    class Meta:
 | 
					      class Meta:
 | 
				
			||||||
        interfaces = (Node, )
 | 
					          interfaces = (Node, )
 | 
				
			||||||
```
 | 
					  ```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## SQLAlchemy
 | 
					## SQLAlchemy
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -162,11 +162,11 @@ For installing, you have to replace the old `graphene[sqlalchemy]` with `graphen
 | 
				
			||||||
* As the package is now independent, you have to import now from `graphene_sqlalchemy`.
 | 
					* As the package is now independent, you have to import now from `graphene_sqlalchemy`.
 | 
				
			||||||
* **SQLAlchemyNode no longer exists**, please use `relay.Node` instead:
 | 
					* **SQLAlchemyNode no longer exists**, please use `relay.Node` instead:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```python
 | 
					  ```python
 | 
				
			||||||
from graphene.relay import Node
 | 
					  from graphene.relay import Node
 | 
				
			||||||
from graphene_sqlalchemy import SQLAlchemyObjectType
 | 
					  from graphene_sqlalchemy import SQLAlchemyObjectType
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class Droid(SQLAlchemyObjectType):
 | 
					  class Droid(SQLAlchemyObjectType):
 | 
				
			||||||
    class Meta:
 | 
					      class Meta:
 | 
				
			||||||
        interfaces = (Node, )
 | 
					          interfaces = (Node, )
 | 
				
			||||||
```
 | 
					  ```
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user