mirror of
				https://github.com/OpenAPITools/openapi-generator.git
				synced 2025-11-04 10:43:44 +00:00 
			
		
		
		
	[Clojure] Add util method to set the api-context globally (#93)
This commit is contained in:
		
							parent
							
								
									d890d733f8
								
							
						
					
					
						commit
						d7e374504f
					
				@ -24,6 +24,11 @@
 | 
			
		||||
  "Dynamic API context to be applied in API calls."
 | 
			
		||||
  default-api-context)
 | 
			
		||||
 | 
			
		||||
(defn set-api-context
 | 
			
		||||
  "Set the *api-context* globally"
 | 
			
		||||
  [new-context]
 | 
			
		||||
  (alter-var-root #'*api-context* (constantly (merge *api-context* new-context))))
 | 
			
		||||
 | 
			
		||||
(defmacro with-api-context
 | 
			
		||||
  "A helper macro to wrap *api-context* with default values."
 | 
			
		||||
  [api-context & body]
 | 
			
		||||
 | 
			
		||||
@ -24,6 +24,11 @@
 | 
			
		||||
  "Dynamic API context to be applied in API calls."
 | 
			
		||||
  default-api-context)
 | 
			
		||||
 | 
			
		||||
(defn set-api-context
 | 
			
		||||
  "Set the *api-context* globally"
 | 
			
		||||
  [new-context]
 | 
			
		||||
  (alter-var-root #'*api-context* (constantly (merge *api-context* new-context))))
 | 
			
		||||
 | 
			
		||||
(defmacro with-api-context
 | 
			
		||||
  "A helper macro to wrap *api-context* with default values."
 | 
			
		||||
  [api-context & body]
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user