[python/FastAPI] http 422 unprocessable entity 오류
내 경우는 model 멤버의 데이터타입 때문에 발생했었다. ( string을 보냈는데 int 로 받음 ) 참고 https://velog.io/@ryu_log/%EB%82%B4%EA%B0%80-%EA%B2%AA%EC%9D%80-422-%EC%97%90%EB%9F%AC-FastAPI
내 경우는 model 멤버의 데이터타입 때문에 발생했었다. ( string을 보냈는데 int 로 받음 ) 참고 https://velog.io/@ryu_log/%EB%82%B4%EA%B0%80-%EA%B2%AA%EC%9D%80-422-%EC%97%90%EB%9F%AC-FastAPI
TEST_TABLE = sqlalchemy.Table( "TEST_TABLE", metadata, sqlalchemy.Column("user_id", sqlalchemy.Integer), sqlalchemy.Column("del_yn", sqlalchemy.String), sqlalchemy.Column("update_time", sqlalchemy.DateTime) ) # MAX_HISTORY 관리를 위한 delete 작업 MAX_HISTORY = 10 # 레코드를 이 개수만 유지 (FIFO) where_clause = f"""user_id={user_id} AND del_yn <> 'Y'""" query = f""" /* 수정일시 – ISO 8601 format (명시적 datetime 객체 바인딩이 아니라 sqlalchemy.engine.row.Row 로 자동 바인딩 되므로 쿼리단에서 포맷팅… Read More »
간단 요약 프로젝트 루트경로 > .next 폴더를 지우고 재실행 참고 https://stackoverflow.com/questions/67652612/chunkloaderror-loading-chunk-node-modules-next-dist-client-dev-noop-js-failed
개요 가변적으로 row가 추가되는 동적 UI에서 각 컴포넌트의 데이터 초기화, focus 등을 수행하기 위해 ref 가 필요한 사례가 있었음. (ref 배열, array) 소스 const testRefs = useRef<any>([]); … <Input ref={ (el) => (testRefs.current[idx] = el) } … /> … const ref = testRefs.current[idx]; …
onChange={_.debounce((o: any) => handleChange(o, etc), 500)}
환경 react 17.0.2 moment-timezone 0.5.34 소스 import moment from 'moment-timezone'; // tz 를 사용하려면 이걸로 import 해야 함. // 기본 timezone 지정 const DEFAULT_TIMEZONE = 'Asia/Seoul'; // const DEFAULT_TIMEZONE = 'America/New_York'; // 날짜 기간 검색시 기본 기간 export const DEFAULT_SEARCH_PERIOD_DAYS = 7; const cur = moment.tz(new Date(), DEFAULT_TIMEZONE); const start = cur.clone().add((-1 * DEFAULT_SEARCH_PERIOD_DAYS), 'days');… Read More »
환경 python 3.9 pydantic 1.9.0 sqlalchemy 1.4.31 fastapi 0.73.0 소스 # 리스트 내 요소 모델 class Prod(BaseModel): field1: Optional[str] field2: Optional[int] field3: Optional[Union[str, List[str]]] # 두 가지 타입을 받을 수 있도록 Union 처리 # 리스트 모델 class TestModel(BaseModel): site_id: Optional[int] update_time: Optional[datetime] alias: Optional[str] path: Optional[str] prod_list: Optional[List[Prod]] # 목록(리스트,List)형 파라미터 consume # DB 모델… Read More »
환경 python 3.9 소스 """ 평문을 인수로 받아서 hex encoded string을 리턴한다. """ @staticmethod def encode_hex(src: str): if not src: return '' return src.encode('utf-8').hex() """ hex encoded string을 인수로 받아서 평문을 리턴한다. """ @staticmethod def decode_hex(enc: str): if not enc: return '' return bytearray.decode(bytearray.fromhex(enc))
C:\ProgramData\KONAMI 폴더를 지운다.
css .ant-form-item { margin-bottom: 0; } .ant-form-item-control { max-width: 100%; } 참고 https://stackoverflow.com/questions/56782898/how-to-reduce-spacing-between-antd-form-items
개요 react axios 공통화 작업(interceptor 등)을 하던 중, 에러 메시지 알림에 debounce 처리를 해야 하는 요건이 발생. 소스 axios-settings.ts (커스텀 파일) /** * axios 기본설정 */ const axiosOpts = { // timeout: 5000, // headers: { // "Content-Type": "application/json", // }, }; // export const ax = Axios.create(axiosOpts); // /** * axios response interceptor */… Read More »
환경 python 3.9 fastapi 0.73.0 pydantic 1.9.0 (VO객체 validtion, json encode/decode 등에 관여하는 라이브러리로 보임) 이슈 MySql에서 select한 datetime 컬럼을 별도의 형식 변환 없이 React client에 전달하고, React에서는 dayjs 를 사용하여 포맷팅/출력 해 주고 싶다. 현재는 api response에 타임존(timezone) 정보가 없기 때문에 국제화 출력이 불가한 상태 현재 DB의 timezone은 KST가 아닌 UTC라고 가정한다. 해결 기본적으로… Read More »
가장 쉬운 결론 if (window !== undefined) { // browser code } 출처 https://dev.to/vvo/how-to-solve-window-is-not-defined-errors-in-react-and-next-js-5f97
요건 A가 api 프로젝트고 B가 lib 프로젝트라고 했을 때, A가 컴파일시 B를 참조하는데, B의 수정사항을 즉시(B의 maven install을 거치지 않고 컴파일 만으로) A가 사용할 수 있게 하고 싶다. 프로젝트 구성 A의 pom.xml 에는 maven install 된 B.jar가 하나의 dependency 로 들어가 있다. 문제상황 B에 신규 메서드를 추가하고 컴파일 한 후, A에서 B의 신규 메서드를 사용하려고… Read More »
https://archwin.net/437
https://store.kakaofriends.com/info/brand
진짜 JEUS는 알면 알수록, 겪으면 겪을수록 짜증이 난다. 톰캣에서는 잘 도는 것들이 왜 이리 안되는 것들이 많은지. 기존 오류 발생 코드 (MultipartFile => File) 이렇게 할 경우, targetFile의 위치가 엄연히 /로 시작하는 서버 루트에서부터의 경로임에도 불구하고, JEUS application 배포 경로부터 시작하는 긴 경로에서 파일을 찾아 기록하려고 하다가 에러를 발생시킨다. mFile.transferTo(targetFile); 수정한 코드 (MultipartFile => File)… Read More »
처음에는 오라클 db의 문제라고 생각했었으나, 로그를 거슬러 올라가니 OOME(GC overhead limit exceeded)가 원인임을 알게 되었다. 왜 OOME가 났는지 서버설정을 살펴보니, 누가 3기가로 설정해 놨던 heap memory를 1기가로 줄여놓았던 것이 원인이었다. 아놔..
환경 spring boot 1.5.22 (spring 4.3.25) JEUS 7 Fix#5 개요 잘 돌던 시스템이, apache poi를 pom에 추가한 시점부터 JEUS 서버 기동시 오류를 내뿜었다. (주로 logback.xml 을 읽지 못했다… 라는 내용의 로그였음) 해결 pom.xml > dependency > poi-ooxml 에 아래와 같이 exclusion 처리 추가 <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi-ooxml</artifactId> <version>3.9</version> <exclusions> <exclusion> <groupId>xml-apis</groupId> <artifactId>xml-apis</artifactId> </exclusion> </exclusions> </dependency> 출처… Read More »
https://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html